From 02ce25ba01c8011d26e7ff2ca1900aaa5f1f63e0 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Tue, 16 May 2017 13:45:37 +0200 Subject: [PATCH] [FIX] purchase: prevent rounding during currency conversion With the settings: - Anglo saxon accounting - real price on product, perpetual accounting, - multicurrency - a product with a very small uom (like gram or kilograms and you want to sell many of them, like 500kg) Flow: purchasing something in another currency Before this commit, the rounding of the unit price took place right at the conversion level which led the rounding errors to be amplified by the quantities when the total price was computed After this commit, the conversion is done on the unit price but is not rounded yet Only the prices are rounded, as late as possible OPW 742293 Closes #17015 --- addons/purchase/models/account_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/models/account_invoice.py b/addons/purchase/models/account_invoice.py index 873921b322f..c140ada3bdd 100644 --- a/addons/purchase/models/account_invoice.py +++ b/addons/purchase/models/account_invoice.py @@ -156,7 +156,7 @@ class AccountInvoice(models.Model): valuation_price_unit = valuation_price_unit_total / valuation_total_qty valuation_price_unit = i_line.product_id.uom_id._compute_price(valuation_price_unit, i_line.uom_id) if inv.currency_id.id != company_currency.id: - valuation_price_unit = company_currency.with_context(date=inv.date_invoice).compute(valuation_price_unit, inv.currency_id) + valuation_price_unit = company_currency.with_context(date=inv.date_invoice).compute(valuation_price_unit, inv.currency_id, round=False) if valuation_price_unit != i_line.price_unit and line['price_unit'] == i_line.price_unit and acc: # price with discount and without tax included price_unit = i_line.price_unit * (1 - (i_line.discount or 0.0) / 100.0)