From 5ca1ee4fff8a0b24a6d5835d5016e924b7932be1 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 10 Oct 2011 17:42:41 +0200 Subject: [PATCH] [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 --- addons/stock/wizard/stock_fill_inventory.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/stock/wizard/stock_fill_inventory.py b/addons/stock/wizard/stock_fill_inventory.py index 03ddb1d7a7f..5c5e8964e9a 100644 --- a/addons/stock/wizard/stock_fill_inventory.py +++ b/addons/stock/wizard/stock_fill_inventory.py @@ -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']