Amit Dodiya (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-381931-ado into 
lp:openobject-addons/6.0.

Requested reviews:
  nel (nel-tinyerp)
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-381931-ado/+merge/91620

Hello,

[FIX] Fill inventory is incorrect

When we fill the inventory it searches all moves that have location_dest_id = 
(locations selected) and state = 'done' but this wizard doesn't subtract 
consumed quantity (location_id = (locations selected and state='done') with 
total received quantity.

So the quantity is filled in inventory is incorrect(double).

Code is Back-ported from trunk.

Thanks,
Amit
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-381931-ado/+merge/91620
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-381931-ado.
=== 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	2012-02-06 09:22:22 +0000
@@ -86,12 +86,16 @@
         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 = move.product_qty
+                else:
+                    qty = -move.product_qty
                 
                 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