From e6701a6a9a46100c628f70cc3578d79681c044cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 21 Jul 2021 23:57:42 +0200 Subject: [PATCH] Prevent overpay invoice without amount to pay issue10573 review369291002 --- invoice.py | 4 ++++ message.xml | 3 +++ 2 files changed, 7 insertions(+) diff --git a/invoice.py b/invoice.py index f000a13a7c..da07842aca 100644 --- a/invoice.py +++ b/invoice.py @@ -3053,6 +3053,10 @@ class PayInvoice(Wizard): 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 --git a/message.xml b/message.xml index 64b1e925bc..f716d48040 100644 --- a/message.xml +++ b/message.xml @@ -63,6 +63,9 @@ this repository contains the full copyright notices and license terms. --> You cannot add a partial payment on invoice "%(invoice)s" with an amount greater than the amount to pay "%(amount_to_pay)s". + + You cannot overpay invoice "%(invoice)s" because there is no more left to pay. + A payment line can be linked to only one invoice.