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

TT38927 TT39037

account_move_reconcile_forbid_cancel 13.0.1.0.2
pull/568/head
Carlos Dauden 2022-09-20 13:26:06 +02:00 committed by Alejandro Ji Cheung
parent c856cad6f7
commit d0b6d703c2
2 changed files with 7 additions and 5 deletions

View File

@ -3,7 +3,7 @@
{
"name": "Account Move Reconcile Forbid Cancel",
"version": "13.0.1.0.1",
"version": "13.0.1.0.2",
"category": "Finance",
"website": "https://github.com/OCA/account-reconcile",
"author": "Tecnativa, Odoo Community Association (OCA)",

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: