[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
This commit is contained in:
Carlos Lopez
2022-02-24 17:47:15 -05:00
parent 18a820d39f
commit 85997ce2cc

View File

@@ -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"}
)