From 89c11279529a69a005e8620a62dfbc01509683ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 30 Mar 2024 11:32:22 +0100 Subject: [PATCH] Enforce clearing account type only on draft payment As the receivable, payable type may evolve over time, only draft state should enforce it. Closes #13145 --- modules/account_payment_clearing/payment.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/account_payment_clearing/payment.py b/modules/account_payment_clearing/payment.py index 90577c4fbf..a3ecb84b07 100644 --- a/modules/account_payment_clearing/payment.py +++ b/modules/account_payment_clearing/payment.py @@ -179,10 +179,12 @@ class Payment(metaclass=PoolMeta): @classmethod def _account_type_domain(cls): - return If(Eval('kind') == 'receivable', - ('type.receivable', '=', True), - ('type.payable', '=', True), - ) + return If(Eval('state') == 'draft', + If(Eval('kind') == 'receivable', + ('type.receivable', '=', True), + ('type.payable', '=', True), + ), + ()) @fields.depends('party', 'kind', 'date') def on_change_party(self):