From 1de11e7e120b6a0c965850a2963eb38b687e027a Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 Oct 2013 10:22:48 +0100 Subject: [PATCH] [FIX] account_statement: crash when creating a new bank statement without any lines --- account_statement_ext/statement.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index f8762054..03e1c31c 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -31,9 +31,10 @@ def fixed_write(self, cr, uid, ids, vals, context=None): I will do it when I have time.""" res = super(stat_mod.account_bank_statement, self).write(cr, uid, ids, vals, context=context) - cr.execute("UPDATE account_bank_statement_line" - " SET sequence = account_bank_statement_line.id + 1" - " where statement_id in %s", (tuple(ids),)) + if ids: # will be false for an new empty bank statement + cr.execute("UPDATE account_bank_statement_line" + " SET sequence = account_bank_statement_line.id + 1" + " where statement_id in %s", (tuple(ids),)) return res stat_mod.account_bank_statement.write = fixed_write