From 85997ce2cc1f25d7662dced818535e7b3eaa7fe2 Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Thu, 24 Feb 2022 17:47:15 -0500 Subject: [PATCH] [FIX] account_document_reversal: pass active_ids and active_model correctly * before this commit, If try reversal from account.payment when create is call, active_model and active_ids can be of account.payment and not account.move. this commit avoid confussed --- account_document_reversal/models/account_move.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/account_document_reversal/models/account_move.py b/account_document_reversal/models/account_move.py index 3a17031b6..a27009ab3 100644 --- a/account_document_reversal/models/account_move.py +++ b/account_document_reversal/models/account_move.py @@ -70,10 +70,10 @@ class AccountMove(models.Model): self.mapped("line_ids").filtered( lambda x: x.account_id.reconcile ).remove_move_reconcile() - Reversal = self.env["account.move.reversal"] - res = Reversal.with_context( + Reversal = self.env["account.move.reversal"].with_context( active_ids=self.ids, active_model="account.move" - ).default_get([]) + ) + res = Reversal.default_get([]) res.update( {"journal_id": journal_id, "refund_method": "cancel", "move_type": "entry"} )