changeset 08f9eac33949 in modules/account_invoice:6.2
details: 
https://hg.tryton.org/modules/account_invoice?cmd=changeset&node=08f9eac33949
description:
        Set overpayment in the company currency

        issue11608
        review431381003
        (grafted from 5cf30e9b57c9718fdf2a3291150d5bc920ad1545)
diffstat:

 invoice.py |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (16 lines):

diff -r 6420d09db7f4 -r 08f9eac33949 invoice.py
--- a/invoice.py        Thu Aug 04 00:04:03 2022 +0200
+++ b/invoice.py        Sat Aug 06 10:26:51 2022 +0200
@@ -3119,7 +3119,11 @@
                     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):

Reply via email to