From 6de2990f8d45074d39917ab132791b3ddc7e6e30 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 16 May 2017 11:50:06 +0200 Subject: [PATCH] [FIX] account: reset the move reference on bank statement When removing a move previously linked to a bank statement, the move_name value must be removed too. This field is set when reconciling the entries. When move_name is set, it is not possible to delete the bank statement line, even if the refered move no longer exists. opw-741205 --- addons/account/models/account_move.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 5a135044abe..edee204410e 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -174,6 +174,11 @@ class AccountMove(models.Model): #check the lock date + check if some entries are reconciled move.line_ids._update_check() move.line_ids.unlink() + + # remove reference set at statement reconciliation + if move.statement_line_id.move_name: + move.statement_line_id.move_name = False + return super(AccountMove, self).unlink() @api.multi