From c7c938996f783cbb187697b9f36c8359b2c4733f Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 6 Feb 2019 10:24:09 +0000 Subject: [PATCH] [FIX] account: analytic cost - Set a cost of 12.34 for product P - Create manually a new analytic entry - Choose product P - Set desired quantity The analytic amount is set to 12.00. This is because `move_id` is empty, therefore `currency_id` is empty as well and `decimal_places` is zero opw-1924184 closes odoo/odoo#30869 --- addons/account/models/account_analytic_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_analytic_line.py b/addons/account/models/account_analytic_line.py index 20b44c04dbb..5f001ad34dd 100644 --- a/addons/account/models/account_analytic_line.py +++ b/addons/account/models/account_analytic_line.py @@ -44,7 +44,7 @@ class AccountAnalyticLine(models.Model): # Compute based on pricetype amount_unit = self.product_id.price_compute('standard_price', uom=unit)[self.product_id.id] amount = amount_unit * self.unit_amount or 0.0 - result = round(amount, self.currency_id.decimal_places) * -1 + result = round(amount, self.currency_id.decimal_places if self.currency_id else 2) * -1 self.amount = result self.general_account_id = account self.product_uom_id = unit