← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/6.0-opw_bug-747379-rpa into lp:openobject-addons/6.0

 

Rucha (Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/6.0-opw_bug-747379-rpa into lp:openobject-addons/6.0.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #747379 in OpenERP Addons: "[6.0] inventory : wrong stocks moves generated when using production lot"
  https://bugs.launchpad.net/openobject-addons/+bug/747379

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw_bug-747379-rpa/+merge/56936

Fixed validating inventory with production lot
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw_bug-747379-rpa/+merge/56936
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/6.0-opw_bug-747379-rpa.
=== modified file 'stock/product.py'
--- stock/product.py	2011-01-14 00:11:01 +0000
+++ stock/product.py	2011-04-08 13:38:13 +0000
@@ -248,6 +248,7 @@
             date_str = "date<=%s"
             date_values = [to_date]
 
+        prodlot_id = context.get('prodlot_id', False)
 
     # TODO: perhaps merge in one query.
         if date_values:
@@ -257,10 +258,11 @@
             cr.execute(
                 'select sum(product_qty), product_id, product_uom '\
                 'from stock_move '\
-                'where location_id NOT IN %s'\
-                'and location_dest_id IN %s'\
-                'and product_id IN %s'\
-                'and state IN %s' + (date_str and 'and '+date_str+' ' or '') +''\
+                'where location_id NOT IN %s '\
+                'and location_dest_id IN %s '\
+                'and product_id IN %s '\
+                '' + (prodlot_id and ('and prodlot_id = ' + str(prodlot_id)) or '') + ' '\
+                'and state IN %s ' + (date_str and 'and '+date_str+' ' or '') +' '\
                 'group by product_id,product_uom',tuple(where))
             results = cr.fetchall()
         if 'out' in what:
@@ -268,10 +270,11 @@
             cr.execute(
                 'select sum(product_qty), product_id, product_uom '\
                 'from stock_move '\
-                'where location_id IN %s'\
+                'where location_id IN %s '\
                 'and location_dest_id NOT IN %s '\
-                'and product_id  IN %s'\
-                'and state in %s' + (date_str and 'and '+date_str+' ' or '') + ''\
+                'and product_id  IN %s '\
+                '' + (prodlot_id and ('and prodlot_id = ' + str(prodlot_id)) or '') + ' '\
+                'and state in %s ' + (date_str and 'and '+date_str+' ' or '') + ' '\
                 'group by product_id,product_uom',tuple(where))
             results2 = cr.fetchall()
         uom_obj = self.pool.get('product.uom')

=== modified file 'stock/stock.py'
--- stock/stock.py	2011-04-04 10:02:08 +0000
+++ stock/stock.py	2011-04-08 13:38:13 +0000
@@ -2556,7 +2556,7 @@
             move_ids = []
             for line in inv.inventory_line_id:
                 pid = line.product_id.id
-                product_context.update(uom=line.product_uom.id,date=inv.date)
+                product_context.update(uom=line.product_uom.id, date=inv.date, prodlot_id=line.prod_lot_id.id)
                 amount = location_obj._product_get(cr, uid, line.location_id.id, [pid], product_context)[pid]
 
                 change = line.product_qty - amount


Follow ups