Rifakat (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.1-opw-575875-rha into
lp:openobject-addons/6.1.
Requested reviews:
Olivier Dony (OpenERP) (odo-openerp)
Related bugs:
Bug #1008099 in OpenERP Addons: "stock inventory - wrong stock_moves if moves
with prodlots and without exists for one product and location"
https://bugs.launchpad.net/openobject-addons/+bug/1008099
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-575875-rha/+merge/110601
Hello,
When filling the inventory line with product and does not provide production
lot then totol qty
should return qty withouht production lot(prodlot_id==Null) but currently it
does not distinguish
and retund all qty with and without lot. It leads to wrong creation of stock
moves.
Also I have put check on inventory line for production lot, when product's
incoming tracking is
required so one must have to provide production lot in inventory line.
One should have general practice to fill the inventory lines using 'Fill
Inventory' wizard in
order to avoid problem for stock.
Please review this fix.
Regards,
Rifakat
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-575875-rha/+merge/110601
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.1-opw-575875-rha.
=== modified file 'stock/product.py'
--- stock/product.py 2012-01-31 13:36:57 +0000
+++ stock/product.py 2012-06-15 19:07:29 +0000
@@ -262,7 +262,8 @@
'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 '') + ' '\
+ '' + (('prodlot_id' in context and not prodlot_id and 'and prodlot_id is null') or
+ (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()
@@ -274,7 +275,8 @@
'where location_id IN %s '\
'and location_dest_id NOT IN %s '\
'and product_id IN %s '\
- '' + (prodlot_id and ('and prodlot_id = ' + str(prodlot_id)) or '') + ' '\
+ '' + (('prodlot_id' in context and not prodlot_id and 'and prodlot_id is null') or
+ (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()
=== modified file 'stock/stock.py'
--- stock/stock.py 2012-03-29 15:29:29 +0000
+++ stock/stock.py 2012-06-15 19:07:29 +0000
@@ -2673,6 +2673,9 @@
move_ids = []
for line in inv.inventory_line_id:
pid = line.product_id.id
+ if line.product_id.track_incoming and not line.prod_lot_id:
+ raise osv.except_osv(_('Warning'),
+ _('Please provide "Production Lot" as incoming tracking lot is required for "%s".') %line.product_id.name)
product_context.update(uom=line.product_uom.id, to_date=inv.date, 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]
_______________________________________________
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