From b5ed5d2ccad62da30eb92e76c8f43611dfc232fd Mon Sep 17 00:00:00 2001 From: "nel@tinyerp.com" <> Date: Mon, 7 Jun 2010 16:26:20 +0200 Subject: [PATCH] [FIX] stock: split production lots bzr revid: nel@tinyerp.com-20100607142620-26gm67x3n6bs4rlw --- addons/stock/wizard/stock_move.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/stock/wizard/stock_move.py b/addons/stock/wizard/stock_move.py index 00b7b616aa5..aa7bb42cf8b 100644 --- a/addons/stock/wizard/stock_move.py +++ b/addons/stock/wizard/stock_move.py @@ -258,7 +258,7 @@ class split_in_production_lot(osv.osv_memory): quantity_rest -= quantity uos_qty = quantity / move_qty * move.product_uos_qty uos_qty_rest = quantity_rest / move_qty * move.product_uos_qty - if quantity_rest <= 0: + if quantity_rest < 0: quantity_rest = quantity break default_val = { @@ -266,8 +266,11 @@ class split_in_production_lot(osv.osv_memory): 'product_uos_qty': uos_qty, 'state': move.state } - current_move = move_obj.copy(cr, uid, move.id, default_val) - new_move.append(current_move) + if quantity_rest > 0: + current_move = move_obj.copy(cr, uid, move.id, default_val) + new_move.append(current_move) + if quantity_rest == 0: + current_move = move.id prodlot_id = False if line.use_exist and line.name: prodlot_id = prodlot_obj.search(cr, uid, [('prefix','=',line.name),('product_id','=',data.product_id.id)])