[FIX] Fix floating point handling in purchase _prepare_order_line_move

Without this better floating point handling, an extra stock move might
be created for zero quantity for some order lines upon PO confirmation,
because qty is equal to something closer to e.g 1.14e-13, but this is
larger than 0, so it creates a stock.move, which gets rounded too late
to 0.0

Closes #3346
This commit is contained in:
Mart Raudsepp 2014-12-02 13:26:17 +00:00 committed by Josse Colpaert
parent 05de60cbf9
commit 7a979b2d3e
1 changed files with 1 additions and 1 deletions

View File

@ -756,7 +756,7 @@ class purchase_order(osv.osv):
res.append(tmp)
#if the order line has a bigger quantity than the procurement it was for (manually changed or minimal quantity), then
#split the future stock move in two because the route followed may be different.
if diff_quantity > 0:
if float_compare(diff_quantity, 0.0, precision_rounding=order_line.product_uom.rounding) > 0:
move_template['product_uom_qty'] = diff_quantity
move_template['product_uos_qty'] = diff_quantity
res.append(move_template)