Forbid the payment of an amount of 0 when the amount is editable

Closes #14670
This commit is contained in:
Cédric Krier
2026-03-11 19:04:22 +01:00
parent 03655a335a
commit 3b292c46b7
+8 -1
View File
@@ -303,7 +303,14 @@ class Payment(Workflow, ModelSQL, ModelView, ChatMixin):
date = fields.Date('Date', required=True, states=_STATES)
amount = Monetary(
"Amount", currency='currency', digits='currency', required=True,
domain=[('amount', '>=', 0)],
domain=[
If(Eval('state').in_(
If(Eval('process_method') == 'manual',
['draft', 'processing'],
['draft'])),
('amount', '>', 0),
('amount', '>=', 0)),
],
states={
'readonly': ~Eval('state').in_(
If(Eval('process_method') == 'manual',