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
This commit is contained in:
Cédric Krier
2024-03-30 11:32:22 +01:00
parent 79e5ab807d
commit 89c1127952
+6 -4
View File
@@ -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):