[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) <las@odoo.com>
This commit is contained in:
Sohail Jaidi (soja)
2023-09-12 07:12:33 +00:00
parent 547a48f77b
commit 01761f8471
+1 -1
View File
@@ -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',