From ed263e083dcb49bdd3f2d6cc707008cb5fe8ce1b Mon Sep 17 00:00:00 2001 From: Vincent Renaville Date: Mon, 11 Nov 2013 13:33:43 +0100 Subject: [PATCH 1/2] [FIX] remove account.reconcile before deleting a account.move --- account_statement_ext/account.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/account_statement_ext/account.py b/account_statement_ext/account.py index 8dab9449..97f1103f 100644 --- a/account_statement_ext/account.py +++ b/account_statement_ext/account.py @@ -31,8 +31,11 @@ class account_move(Model): Delete the reconciliation when we delete the moves. This allow an easier way of cancelling the bank statement. """ + reconcile_to_delete = [] + reconcile_obj = self.pool.get('account.move.reconcile') for move in self.browse(cr, uid, ids, context=context): for move_line in move.line_id: if move_line.reconcile_id: - move_line.reconcile_id.unlink(context=context) + reconcile_to_delete.append(move_line.reconcile_id.id) + reconcile_obj.unlink(cr,uid,reconcile_to_delete,context=context) return super(account_move, self).unlink(cr, uid, ids, context=context) From 9080e3d6c8a491df0db5344f5cfe06e7af762d27 Mon Sep 17 00:00:00 2001 From: Vincent Renaville Date: Fri, 13 Dec 2013 15:06:53 +0100 Subject: [PATCH 2/2] [FIX] PEP8 --- account_statement_ext/account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_statement_ext/account.py b/account_statement_ext/account.py index 97f1103f..ecd1853c 100644 --- a/account_statement_ext/account.py +++ b/account_statement_ext/account.py @@ -36,6 +36,6 @@ class account_move(Model): for move in self.browse(cr, uid, ids, context=context): for move_line in move.line_id: if move_line.reconcile_id: - reconcile_to_delete.append(move_line.reconcile_id.id) - reconcile_obj.unlink(cr,uid,reconcile_to_delete,context=context) + reconcile_to_delete.append(move_line.reconcile_id.id) + reconcile_obj.unlink(cr, uid, reconcile_to_delete, context=context) return super(account_move, self).unlink(cr, uid, ids, context=context)