[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
This commit is contained in:
Harry (OpenERP)
2011-12-22 15:23:38 +05:30
parent 6d23ac32bc
commit ff625ae05f
+5 -4
View File
@@ -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)