Rifakat (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-51092-rha into 
lp:openobject-addons/6.0.

Requested reviews:
  Priyesh (OpenERP) (pso-openerp)
Related bugs:
  Bug #828370 in OpenERP Addons: "Physical Inventory - wrong accounting entries"
  https://bugs.launchpad.net/openobject-addons/+bug/828370

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-51092-rha/+merge/85084

Hello,

Fill inventory wizard was filling wrong quantity of products from the stock 
location, backported from Trunk r5339

Kindly review it.

Thanks,
Rifakat
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-51092-rha/+merge/85084
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-51092-rha.
=== modified file 'stock/wizard/stock_fill_inventory.py'
--- stock/wizard/stock_fill_inventory.py	2011-04-21 09:00:39 +0000
+++ stock/wizard/stock_fill_inventory.py	2011-12-09 09:10:37 +0000
@@ -69,6 +69,7 @@
         location_obj = self.pool.get('stock.location')
         product_obj = self.pool.get('product.product')
         move_obj = self.pool.get('stock.move')
+        uom_obj = self.pool.get('product.uom')
         
         fill_inventory = self.browse(cr, uid, ids[0], context=context)
         res = {}
@@ -86,12 +87,15 @@
         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 = move.product_qty
+                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']

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to