From ff625ae05f666a35c2aa098f01ec13bb0ea0b866 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 22 Dec 2011 15:23:38 +0530 Subject: [PATCH] [FIX]stock: In consume product, destination location of consumed move should be default production location of product. if not have default production location, take destination location of parent move. bzr revid: hmo@tinyerp.com-20111222095338-h249df9lru5nigno --- addons/stock/stock.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index ce56aa2c89f..bcdf22d1716 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -447,14 +447,12 @@ class stock_location(osv.osv): """, (id, id, product_id)) results += cr.dictfetchall() - total = 0.0 results2 = 0.0 for r in results: amount = self.pool.get('product.uom')._compute_qty(cr, uid, r['product_uom'], r['product_qty'], context.get('uom', False)) results2 += amount total += amount - if total <= 0.0: continue @@ -822,6 +820,7 @@ class stock_picking(osv.osv): """ Tests whether the move is in assigned state or not. @return: True or False """ + #TOFIX: assignment of move lines should be call before testing assigment otherwise picking never gone in assign state ok = True for pick in self.browse(cr, uid, ids): mt = pick.move_type @@ -2428,13 +2427,14 @@ class stock_move(osv.osv): quantity = move.product_qty uos_qty = quantity / move_qty * move.product_uos_qty - + location_dest_id = move.product_id.property_stock_production or move.location_dest_id if quantity_rest > 0: default_val = { 'product_qty': quantity, 'product_uos_qty': uos_qty, 'state': move.state, 'location_id': location_id or move.location_id.id, + 'location_dest_id': location_dest_id.id, } current_move = self.copy(cr, uid, move.id, default_val) res += [current_move] @@ -2450,7 +2450,8 @@ class stock_move(osv.osv): update_val = { 'product_qty' : quantity_rest, 'product_uos_qty' : uos_qty_rest, - 'location_id': location_id or move.location_id.id + 'location_id': location_id or move.location_id.id, + 'location_dest_id': location_dest_id.id, } self.write(cr, uid, [move.id], update_val)