[FIX] account_voucher: implemented on_change to set voucher date based on statement...
authorRifakat <rha@tinyerp.com>
Wed, 15 May 2013 10:57:28 +0000 (16:27 +0530)
committerRifakat <rha@tinyerp.com>
Wed, 15 May 2013 10:57:28 +0000 (16:27 +0530)
bzr revid: rha@tinyerp.com-20130515105728-u4zh5jb4biphx1h8

1  2 
addons/account_voucher/account_voucher.py
addons/account_voucher/account_voucher_view.xml

@@@ -1645,6 -1608,6 +1645,13 @@@ account_bank_statement(
  
  class account_bank_statement_line(osv.osv):
      _inherit = 'account.bank.statement.line'
++    
++    def onchange_line_date(self, cr, uid, ids, date, context=None):
++        voucher_obj = self.pool.get('account.voucher')
++        for statement_line in self.browse(cr, uid, ids, context=context):
++            if statement_line.voucher_id:
++                voucher_obj.write(cr, uid, [statement_line.voucher_id.id], {'date': date}, context=context)
++        return {}
  
      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)
                  <field name="amount" position="attributes">
                      <attribute name="on_change">onchange_amount(amount)</attribute>
                  </field>
++                <xpath expr="//page[@name='statement_line_ids']/field[@name='line_ids']/tree/field[@name='date']" position="attributes">
++                    <attribute name="on_change">onchange_line_date(date)</attribute>
++                </xpath>
              </field>
          </record>