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 {}
<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 < 0 and 'payment' or 'receipt', 'type': amount < 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>