[MERGE] OPW 582080: account: avoid traceback when removing line from journal entry
authorXavier ALT <xal@openerp.com>
Fri, 1 Mar 2013 09:23:42 +0000 (10:23 +0100)
committerXavier ALT <xal@openerp.com>
Fri, 1 Mar 2013 09:23:42 +0000 (10:23 +0100)
  We need to filter-out lines with REMOVE command received by onchange_line_id()
  as resolve_o2m_commands_to_record_dicts() do not support them in v6.1

bzr revid: xal@openerp.com-20130301092342-qvyp6bg52e40h41h

addons/account/account.py

index 46d6d17..f9b1ff3 100644 (file)
@@ -1367,6 +1367,7 @@ class account_move(osv.osv):
 
     def onchange_line_id(self, cr, uid, ids, line_ids, context=None):
         balance = 0.0
+        line_ids = [ line for line in line_ids if not (isinstance(line, (tuple, list)) and line and line[0] == 2) ]
         line_ids = self.resolve_o2m_commands_to_record_dicts(cr, uid, 'line_id', line_ids, context=context)
         for line in line_ids:
             balance += (line['debit'] or 0.00)- (line['credit'] or 0.00)