Require lines when paying invoice with write-off or overpayment

This is needed ensure that at least one line to pay of the invoice is
reconciled.
The lines and payment lines are also shown for overpayment.

Closes #12403
(grafted from 72345bf646caff0e1aa9c373a68906270fe7b688)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2023-07-14 11:59:19 +02:00
1 parent 8474358027
commit 628b3bb336
1 file changed
+4 -3
+4 -3
View File
@@ -2886,7 +2886,7 @@ class PayInvoiceAsk(ModelView):
amount_writeoff = fields.Numeric('Write-Off Amount',
digits=(16, Eval('currency_digits_writeoff', 2)), readonly=True,
depends=['currency_digits_writeoff', 'type'], states={
'invisible': Eval('type') != 'writeoff',
'invisible': ~Eval('type').in_(['writeoff', 'overpayment']),
})
currency_writeoff = fields.Many2One('currency.currency',
'Write-Off Currency', readonly=True, states={
@@ -2902,13 +2902,14 @@ class PayInvoiceAsk(ModelView):
('reconciliation', '=', None),
],
states={
'invisible': Eval('type') != 'writeoff',
'invisible': ~Eval('type').in_(['writeoff', 'overpayment']),
'required': Eval('type').in_(['writeoff', 'overpayment']),
},
depends=['lines_to_pay', 'type'])
payment_lines = fields.Many2Many('account.move.line', None, None,
'Payment Lines', readonly=True,
states={
'invisible': Eval('type') != 'writeoff',
'invisible': ~Eval('type').in_(['writeoff', 'overpayment']),
}, depends=['type'])
company = fields.Many2One('company.company', 'Company', readonly=True)
invoice = fields.Many2One('account.invoice', 'Invoice', readonly=True)