changeset 90ad1ba764a6 in modules/account_invoice:default
details:
https://hg.tryton.org/modules/account_invoice?cmd=changeset&node=90ad1ba764a6
description:
Prevent overpay invoice without amount to pay
issue10573
review369291002
diffstat:
invoice.py | 4 ++++
message.xml | 3 +++
2 files changed, 7 insertions(+), 0 deletions(-)
diffs (27 lines):
diff -r 234bc43d9436 -r 90ad1ba764a6 invoice.py
--- a/invoice.py Mon Jul 12 22:56:26 2021 +0200
+++ b/invoice.py Wed Jul 21 23:57:42 2021 +0200
@@ -3053,6 +3053,10 @@
amount_to_pay=lang.currency(
invoice.amount_to_pay, invoice.currency)))
else:
+ if not invoice.amount_to_pay:
+ raise PayInvoiceError(
+ gettext('account_invoice.msg_invoice_overpay_paid',
+ invoice=invoice.rec_name))
overpayment = amount_invoice - invoice.amount_to_pay
lines = []
diff -r 234bc43d9436 -r 90ad1ba764a6 message.xml
--- a/message.xml Mon Jul 12 22:56:26 2021 +0200
+++ b/message.xml Wed Jul 21 23:57:42 2021 +0200
@@ -63,6 +63,9 @@
<record model="ir.message"
id="msg_invoice_pay_amount_greater_amount_to_pay">
<field name="text">You cannot add a partial payment on invoice
"%(invoice)s" with an amount greater than the amount to pay
"%(amount_to_pay)s".</field>
</record>
+ <record model="ir.message" id="msg_invoice_overpay_paid">
+ <field name="text">You cannot overpay invoice "%(invoice)s"
because there is no more left to pay.</field>
+ </record>
<record model="ir.message" id="msg_invoice_payment_line_unique">
<field name="text">A payment line can be linked to only one
invoice.</field>
</record>