stock wrong computation of internal moves in get_product_available

Bug #998631 reported by Ferdinand
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
OpenERP R&D Addons Team 2

Bug Description

this is a rare hidden bug and will ony happen if
* what is only 'in' OR 'out'
* multiple internal location are selected
* stock moves between the selected internal location exist

        if 'in' in what:
            # all moves from a location out of the set to a location in the set
            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 '\
                '' + (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:
            # all moves from a location in the set to a location out of the set
            cr.execute(
                'select sum(product_qty), product_id, product_uom '\
                'from stock_move '\
                '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 '') + ' '\
                'and state in %s ' + (date_str and 'and '+date_str+' ' or '') + ' '\
                'group by product_id,product_uom',tuple(where))
            results2 = cr.fetchall()

this can be fixed by elimination of the marked conditions
see patch

Related branches

Revision history for this message
Ferdinand (office-chricar) wrote :
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Dr Ferdinand,

I have checked your issue as well as patch and I am totally agree with you as per your patch.

We don't have to check location_id for 'in' picking as well as don't have to check destination location for 'out' picking.

Thanks!

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 2 (openerp-dev-addons2)
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Dr Ferdinand,

This issue has been fixed on lp:~openerp-dev/openobject-addons/trunk-bug-998631-amp branch with following renno and revID.

rev no : 6802
rev ID : <email address hidden>

It will be merge with trunk soon.

Thanks for the contribution!

Changed in openobject-addons:
status: Confirmed → Fix Committed
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

fixed in trunk.
Thanks for reporting.

Changed in openobject-addons:
status: Fix Committed → Fix Released
milestone: none → 7.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.