From 01761f8471b5e7e12a2eddbb4fa5e2ca9382d8cb Mon Sep 17 00:00:00 2001 From: "Sohail Jaidi (soja)" Date: Tue, 5 Sep 2023 15:28:13 +0200 Subject: [PATCH] [FIX] account: fix unwanted reconciliation on draft reversed move The aim of this commit is to prevent reconciliation with credit note to be triggered when a reversed move is reset to draft Context: reconciliation between credit note and invoice (same for vendor bill) Previous to this commit: Post invoice Create and post credit note Reset to draft both the invoice and the credit note Post (confirm) again the credit note -> User error due to attempt of reconciliation between credit note and draft invoice After this commit: The credit note is posted but not reconcilied task-3492197 closes odoo/odoo#134526 X-original-commit: b61395337ca139b6a663628c70c52f8cce87d76f Signed-off-by: Laurent Smet (las) --- addons/account/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index a818485d9d3..b74c83d637c 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -3739,7 +3739,7 @@ class AccountMove(models.Model): wrong_lines.write({'partner_id': invoice.commercial_partner_id.id}) # reconcile if state is in draft and move has reversal_entry_id set - draft_reverse_moves = to_post.filtered(lambda move: move.reversed_entry_id) + draft_reverse_moves = to_post.filtered(lambda move: move.reversed_entry_id and move.reversed_entry_id.state == 'posted') to_post.write({ 'state': 'posted',