From 4392289745ed4bbf667ed6ac3c0ed3c0a894abc7 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 5 May 2015 18:01:30 +0200 Subject: [PATCH] [FIX] account_invoice: residual of invoices in foreign currencies If a line of the invoice move was in a foreign currency but its residual amount in this foreign currency was 0, the `amount_residual` (in company currency) was used, instead of the `amount_residual_currency`, which is the residual amount in this foreign currency. This was due to the fall back with the `and / or` statement. Using `if / else` instead solves the issue. This could lead to issues when the residual amount in the foreign currency was 0, but the residual amount in the company currency was 0.01, due to the exchange rate loss. --- addons/account/account_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 48e6844e67c..4da3e85c6b6 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -131,7 +131,7 @@ class account_invoice(models.Model): continue # Get the correct line residual amount if line.currency_id == self.currency_id: - line_amount = line.currency_id and line.amount_residual_currency or line.amount_residual + line_amount = line.amount_residual_currency if line.currency_id else line.amount_residual else: from_currency = line.company_id.currency_id.with_context(date=line.date) line_amount = from_currency.compute(line.amount_residual, self.currency_id)