[FIX] pos: fixed crash when canceling a cash register without statement lines (set state=draft for canceled statement lines)

bzr revid: tde@openerp.com-20120209143439-puek6acg29g7j53i
This commit is contained in:
Thibault Delavallée 2012-02-09 15:34:39 +01:00
parent 264fd84294
commit bed150e5b0
1 changed files with 4 additions and 3 deletions

View File

@ -50,9 +50,10 @@ class account_bank_statement(osv.osv):
def button_cancel(self, cr, uid, ids, context=None):
super(account_bank_statement, self).button_cancel(cr, uid, ids, context=context)
for st in self.browse(cr, uid, ids, context=context):
cr.execute("UPDATE account_bank_statement_line \
SET state='draft' WHERE id in %s ",
(tuple([x.id for x in st.line_ids]),))
if len(st.line_ids) > 0:
cr.execute("UPDATE account_bank_statement_line \
SET state='draft' WHERE id in %s ",
(tuple([x.id for x in st.line_ids]),))
return True
account_bank_statement()