From 4c53b8e65edd39ba7ecb7f0a62c74ef86e200920 Mon Sep 17 00:00:00 2001 From: Carlos Dauden Date: Tue, 20 Sep 2022 13:26:06 +0200 Subject: [PATCH] [IMP] account_move_reconcile_forbid_cancel: Add context to skip restriction (P.E. payment orders) TT38927 TT39037 --- .../models/account_move.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/account_move_reconcile_forbid_cancel/models/account_move.py b/account_move_reconcile_forbid_cancel/models/account_move.py index a05a0677..e734cfcf 100644 --- a/account_move_reconcile_forbid_cancel/models/account_move.py +++ b/account_move_reconcile_forbid_cancel/models/account_move.py @@ -14,8 +14,9 @@ class AccountMove(models.Model): ) def button_draft(self): - if not tools.config["test_enable"] or self.env.context.get( - "test_reconcile_forbid_cancel" + if not self.env.context.get("skip_reconcile_forbid_cancel") and ( + not tools.config["test_enable"] + or self.env.context.get("test_reconcile_forbid_cancel") ): rec_pay_lines = self._get_receivable_payable_lines() if rec_pay_lines.matched_debit_ids or rec_pay_lines.matched_credit_ids: @@ -25,8 +26,9 @@ class AccountMove(models.Model): super().button_draft() def button_cancel(self): - if not tools.config["test_enable"] or self.env.context.get( - "test_reconcile_forbid_cancel" + if not self.env.context.get("skip_reconcile_forbid_cancel") and ( + not tools.config["test_enable"] + or self.env.context.get("test_reconcile_forbid_cancel") ): rec_pay_lines = self._get_receivable_payable_lines() if rec_pay_lines.matched_debit_ids or rec_pay_lines.matched_credit_ids: