## Controller Python Script "houseaccts_txn_add" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind state=state ##bind subpath=traverse_subpath ##parameters=post_date='', description='', amount='', buyer='', users=[] ##title=Add a transaction from Products.CMFPlone import transaction_note if post_date == '': post_date = None wusers = [] for user in users: wid = 'users_' + user + '_weight' weight = context.REQUEST.form.get(wid) wusers.append((user, weight)) context.addTransaction(description=description, amount=float(amount), buyer=buyer, users=wusers, post_date=post_date) transaction_note('Added transaction at %s' % context.absolute_url()) state.set(portal_status_message='Transaction added.') state.setNextAction('redirect_to:string:view') if context.REQUEST.get('form.button.SaveAndNew'): state.setNextAction('redirect_to:string:newtxn') return state