[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
This commit is contained in:
Goffin Simon
2018-07-17 10:20:12 +02:00
parent 3656999f5e
commit eb2f104e44
+1 -1
View File
@@ -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):