[IMP] Added onchange methods in account_voucher.account_bank_statement_line for parent_id and amount in order to set the voucher_id to False.

bzr revid: vta@openerp.com-20121110180129-ww29a3ciuo90iop5
This commit is contained in:
vta vta@openerp.com 2012-11-10 19:01:29 +01:00
parent e93727ab01
commit 87a3464329
2 changed files with 11 additions and 0 deletions

View File

@ -1557,6 +1557,14 @@ account_bank_statement()
class account_bank_statement_line(osv.osv):
_inherit = 'account.bank.statement.line'
def onchange_partner_id(self, cr, uid, ids, partner_id, context=None):
res = super(account_bank_statement_line, self).onchange_partner_id(cr, uid, ids, partner_id, context=context)
res['value'].update({'voucher_id' : False})
return res
def onchange_amount(self, cr, uid, ids, amount, context=None):
return {'value' : {'voucher_id' : False}}
def _amount_reconciled(self, cursor, user, ids, name, args, context=None):
if not ids:
return {}

View File

@ -225,6 +225,9 @@
<xpath expr="//page[@name='statement_line_ids']/field[@name='line_ids']/form/group/field[@name='sequence']" position="before">
<field name="voucher_id" widget="many2onebutton" context="{'line_type': type, 'default_type': amount &lt; 0 and 'payment' or 'receipt', 'type': amount &lt; 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
</xpath>
<field name="amount" position="attributes">
<attribute name="on_change">onchange_amount(amount)</attribute>
</field>
</field>
</record>