stock inventory - wrong stock_moves if moves with prodlots and without exists for one product and location
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Fix Released
|
Low
|
OpenERP Publisher's Warranty Team |
Bug Description
the following code in
stock/product.py
does not distinguish between
* select all move_lines without prodlots
* select all move_lines with prodlot = null
a query without prodlot returns all moves regardless if these have lots and not
this gives very wrong results for inventory postings
the fix is complex and for now I put in into the module
http://
stock.py
wizard/
I didn't want to patch stock/product.py because it might break some applications which rely on exaclty this behavior.
257 # TODO: perhaps merge in one query.
258 if date_values:
259 where.append(
260 if 'in' in what:
261 # all moves from a location out of the set to a location in the set
262 cr.execute(
263 'select sum(product_qty), product_id, product_uom '\
264 'from stock_move '\
265 'where location_dest_id IN %s '\
266 'and product_id IN %s '\
267 '' + (prodlot_id and ('and prodlot_id = ' + str(prodlot_id)) or '') + ' '\
268 'and state IN %s ' + (date_str and 'and '+date_str+' ' or '') +' '\
269 'group by product_
270 results = cr.fetchall()
271 if 'out' in what:
272 # all moves from a location in the set to a location out of the set
273 cr.execute(
274 'select sum(product_qty), product_id, product_uom '\
275 'from stock_move '\
276 'where location_id IN %s '\
277 'and product_id IN %s '\
278 '' + (prodlot_id and ('and prodlot_id = ' + str(prodlot_id)) or '') + ' '\
279 'and state in %s ' + (date_str and 'and '+date_str+' ' or '') + ' '\
280 'group by product_
281 results2 = cr.fetchall()
Related branches
- Numérigraphe (community): Approve
- Olivier Dony (Odoo): Needs Fixing
-
Diff: 53 lines (+32/-0)2 files modifiedstock/product.py (+2/-0)
stock/test/opening_stock.yml (+30/-0)
- Naresh(OpenERP) (community): Approve
- Numérigraphe (community): Approve
-
Diff: 71 lines (+53/-0)2 files modifiedstock/product.py (+2/-0)
stock/test/stock_test.yml (+51/-0)
Changed in openobject-addons: | |
assignee: | nobody → OpenERP Publisher's Warranty Team (openerp-opw) |
tags: | added: maintenance |
Changed in openobject-addons: | |
status: | Confirmed → In Progress |
importance: | Undecided → Low |
Changed in openobject-addons: | |
status: | Confirmed → Fix Committed |
WMS experts can you please confirm this bug?
Lionel Sausin.