From cfbd086b09faa77f44505e1ba952841e77da6002 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 19 Aug 2015 18:20:21 +0200 Subject: [PATCH] [FIX] account: invoice lines to journal entries currency rounding When converting an invoice in journal entries, the invoice lines amounts must be currency rounded not only when the invoice currency is different than the company invoice, but also when they are the same. Otherwise, a rounding issue can happen if the `Account` decimal accuracy is greater than the currency rounding, the journal entries total and the invoice total could be different. e.g. - Set decimal accuracy of Account and product to 4 - Create a supplier invoice, any supplier - Add a line as follow: - Product: None - Quantity: 2057 - Price unit: 11.9150 - Tax: 16% (create a new tax with 0.16 as percentage) - Validate the invoice - In the other information tab of the invoice, click on the journal entry - Notice that the first line has as credit amount 28430.6150 While the invoice total is 28430.6200 - Now if you try to create a bank statement with one line of -28430.6200 and as partner the supplier you chose in the second step of this explanation, and try to reconciliate it to the invoice created above, the above won't be marked as paid, while it should. opw-647639 Fixes #8135 --- addons/account/account_invoice.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 7fc83b4e42a..1cd11d9fb11 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -744,6 +744,7 @@ class account_invoice(models.Model): else: line['currency_id'] = False line['amount_currency'] = False + line['price'] = self.currency_id.round(line['price']) line['ref'] = ref if self.type in ('out_invoice','in_refund'): total += line['price']