[FIX] mrp: always use float_compare to compare floats
When comparing a float value to 0.0, it can happen the float value is very near to 0.0, but not exactly 0. This is the point to use float_compare, ```float_compare(qty, 0, self.pool['decimal.precision'].precision_get(cr, uid, 'Product Unit of Measure'))´´´ will compare qty to 0, with the product unit of measure precision (0.01 by default). So, if qty is equal to 0.00001, this means the qty is regarded as equal to 0.0. (float_compare will return 1).
This commit is contained in:
+1
-1
@@ -887,7 +887,7 @@ class mrp_production(osv.osv):
|
||||
else:
|
||||
dicts[product_id][lot_id] = quant_qty
|
||||
qty -= quant_qty
|
||||
if qty > 0:
|
||||
if float_compare(qty, 0, self.pool['decimal.precision'].precision_get(cr, uid, 'Product Unit of Measure')) == 1:
|
||||
if dicts[product_id].get(False):
|
||||
dicts[product_id][False] += qty
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user