[FIX] stock: fill inventory wizard now propose the right quantity of products regarding what has been consumed

lp bug: https://launchpad.net/bugs/797772 fixed
lp bug: https://launchpad.net/bugs/837123 fixed

bzr revid: qdp-launchpad@openerp.com-20111010154241-penanv8aggxdcgj3
This commit is contained in:
Quentin (OpenERP) 2011-10-10 17:42:41 +02:00
parent 13a53075f2
commit 5ca1ee4fff
1 changed files with 6 additions and 2 deletions

View File

@ -92,12 +92,16 @@ class stock_fill_inventory(osv.osv_memory):
for location in location_ids:
datas = {}
res[location] = {}
move_ids = move_obj.search(cr, uid, [('location_dest_id','=',location),('state','=','done')], context=context)
move_ids = move_obj.search(cr, uid, ['|',('location_dest_id','=',location),('location_id','=',location),('state','=','done')], context=context)
for move in move_obj.browse(cr, uid, move_ids, context=context):
lot_id = move.prodlot_id.id
prod_id = move.product_id.id
qty = uom_obj._compute_qty(cr, uid, move.product_uom.id,move.product_qty, move.product_id.uom_id.id)
if move.location_dest_id.id == location:
qty = uom_obj._compute_qty(cr, uid, move.product_uom.id,move.product_qty, move.product_id.uom_id.id)
else:
qty = -uom_obj._compute_qty(cr, uid, move.product_uom.id,move.product_qty, move.product_id.uom_id.id)
if datas.get((prod_id, lot_id)):
qty += datas[(prod_id, lot_id)]['product_qty']