Skip to content

Commit

Permalink
[FIX] stock_account: Automated FIFO error on MO
Browse files Browse the repository at this point in the history
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
  • Loading branch information
simongoffin committed Jul 17, 2018
1 parent 3656999 commit eb2f104
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/stock_account/models/stock.py
Expand Up @@ -151,7 +151,7 @@ def action_get_account_moves(self):

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):
Expand Down

1 comment on commit eb2f104

@gustavovalverde
Copy link
Contributor

@gustavovalverde gustavovalverde commented on eb2f104 Jul 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hallelujah ❤️

opw: 1863050

Please sign in to comment.