Avoid a division by zero

This commit is contained in:
Alexis de Lattre
2016-04-26 23:53:35 +02:00
parent 81d97b2981
commit 38dd25f471

View File

@@ -305,6 +305,9 @@ class MrpProduction(orm.Model):
# so we consider that standard_price is in company currency # so we consider that standard_price is in company currency
# It will not work if you are in multi-company environment # It will not work if you are in multi-company environment
# with companies in different currencies # with companies in different currencies
if not qty_before_mo + mo_qty_product_uom:
new_std_price = mo_standard_price
else:
new_std_price = ( new_std_price = (
(product.standard_price * qty_before_mo) + (product.standard_price * qty_before_mo) +
(mo_standard_price * mo_qty_product_uom)) / \ (mo_standard_price * mo_qty_product_uom)) / \