From 9158d82161463d4e2bf1daec3260c8e74faca127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 6 Aug 2022 10:26:51 +0200 Subject: [PATCH] Set overpayment in the company currency issue11608 review431381003 --- invoice.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/invoice.py b/invoice.py index a48b377ad6..c30635411f 100644 --- a/invoice.py +++ b/invoice.py @@ -3197,7 +3197,11 @@ class PayInvoice(Wizard): raise PayInvoiceError( gettext('account_invoice.msg_invoice_overpay_paid', invoice=invoice.rec_name)) - overpayment = amount_invoice - invoice.amount_to_pay + with Transaction().set_context(date=self.start.date): + overpayment = Currency.compute( + invoice.currency, + amount_invoice - invoice.amount_to_pay, + invoice.company.currency) lines = [] if not invoice.company.currency.is_zero(amount):