[IMP] account_move_reconcile_forbid_cancel: Add context to skip restriction (P.E. payment orders)

TT38927 TT39037
This commit is contained in:
Carlos Dauden
2022-09-20 13:26:06 +02:00
parent 6003137b53
commit 4c53b8e65e

View File

@@ -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: