← Back to team overview

openerp-india team mailing list archive

[Bug 1008099] Re: stock inventory - wrong stock_moves if moves with prodlots and without exists for one product and location

 

Hi,

Fix released with following revision ids:

* v6.0: xal@xxxxxxxxxxx-20130204083127-zhbem6lyzfw1hivy
* v6.1: xal@xxxxxxxxxxx-20130204085137-vdd88tfotz0ndo1v

Regards,
Xavier

** Changed in: openobject-addons
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1008099

Title:
  stock inventory - wrong stock_moves if moves with prodlots and without
  exists for one  product and location

Status in OpenERP Addons (modules):
  Fix Released

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://bazaar.launchpad.net/~c2c/c2c-rd-addons/trunk/files/head:/c2c_stock_accounting/
  stock.py
  wizard/stock_fill_inventory.py

  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(tuple(date_values))
  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_id,product_uom',tuple(where))
  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_id,product_uom',tuple(where))
  281             results2 = cr.fetchall()

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1008099/+subscriptions


References