From 297bbff6f54915a1a04050cbd14ec27393285513 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 13 Jun 2016 22:23:26 +0200 Subject: [PATCH] [FIX] stock: use float_compare to avoid an error in the transfer (The roundings of your Unit of Measures kg on the move vs. kg on the product don't allow to do these operations or you are not transferring the picking at once.) --- addons/stock/stock.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 40f3f4a2b43..591dca6652c 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1303,10 +1303,11 @@ class stock_picking(osv.osv): elif ops.product_id.id: #Check moves with same product qty_to_assign = uom_obj._compute_qty_obj(cr, uid, ops.product_uom_id, ops.product_qty, ops.product_id.uom_id, context=context) + precision_rounding = ops.product_id.uom_id.rounding for move_dict in prod2move_ids.get(ops.product_id.id, []): move = move_dict['move'] for quant in move.reserved_quant_ids: - if not qty_to_assign > 0: + if float_compare(qty_to_assign, 0, precision_rounding=precision_rounding) != 1: break if quant.id in quants_in_package_done: continue @@ -1322,7 +1323,7 @@ class stock_picking(osv.osv): max_qty_on_link = min(quant.qty, qty_to_assign) qty_on_link = _create_link_for_quant(ops.id, quant, max_qty_on_link) qty_to_assign -= qty_on_link - qty_assign_cmp = float_compare(qty_to_assign, 0, precision_rounding=ops.product_id.uom_id.rounding) + qty_assign_cmp = float_compare(qty_to_assign, 0, precision_rounding=precision_rounding) if qty_assign_cmp > 0: #qty reserved is less than qty put in operations. We need to create a link but it's deferred after we processed #all the quants (because they leave no choice on their related move and needs to be processed with higher priority)