From eb2f104e441677e9f8b39e20ab99cf373d5c7c5c Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 16 Jul 2018 14:36:17 +0200 Subject: [PATCH] [FIX] stock_account: Automated FIFO error on MO When trying to click on "Mark as Done" on a MO with raw materials in a category with automated fifo valuation, it raised in some a case (in function called "_prepare_account_move_line") a user error saying: "The cost of the product P is currently equal to 0. Change the cost or the configuration of your product to avoid an incorrect valuation" This problem coming from the fact that in some cases, self.price_unit was equal to 1.04166666666667e-06 instead of 0 opw:1862153, 1866692 --- addons/stock_account/models/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock_account/models/stock.py b/addons/stock_account/models/stock.py index af38ff50027..7067c7444da 100644 --- a/addons/stock_account/models/stock.py +++ b/addons/stock_account/models/stock.py @@ -151,7 +151,7 @@ class StockMove(models.Model): def _get_price_unit(self): """ Returns the unit price to store on the quant """ - return self.price_unit or self.product_id.standard_price + return not self.company_id.currency_id.is_zero(self.price_unit) and self.price_unit or self.product_id.standard_price @api.model def _get_in_base_domain(self, company_id=False):