openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #05080
[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-747379-rpa into lp:openobject-addons
Rucha (Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-747379-rpa into lp:openobject-addons.
Requested reviews:
qdp (OpenERP) (qdp)
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/trunk-bug-747379-rpa/+merge/56515
Fixed wrong qty in stock move(posted inventory) when confirming inventory for the products which have earlier moves with production lot and we use the same prodlot
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-747379-rpa/+merge/56515
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-747379-rpa.
=== modified file 'stock/product.py'
--- stock/product.py 2011-01-14 00:11:01 +0000
+++ stock/product.py 2011-04-06 06:56:31 +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-03-31 10:07:25 +0000
+++ stock/stock.py 2011-04-06 06:56:31 +0000
@@ -2580,7 +2580,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