From e8ee0449f574a1b3153481902695a025a6b31f78 Mon Sep 17 00:00:00 2001 From: "Amit (OpenERP)" Date: Fri, 18 May 2012 14:28:18 +0530 Subject: [PATCH] [FIX] stock : fixes some hidden bug on get_product_available function lp bug: https://launchpad.net/bugs/998631 fixed bzr revid: amp@tinyerp.com-20120518085818-8cuybt5d2qsgd3fg --- addons/stock/product.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/stock/product.py b/addons/stock/product.py index e7838bb490a..1450be9c800 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -237,7 +237,7 @@ class product_product(osv.osv): to_date = context.get('to_date',False) date_str = False date_values = False - where = [tuple(location_ids),tuple(location_ids),tuple(ids),tuple(states)] + where = [tuple(location_ids),tuple(ids),tuple(states)] if from_date and to_date: date_str = "date>=%s and date<=%s" where.append(tuple([from_date])) @@ -259,8 +259,7 @@ class product_product(osv.osv): 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 '\ + 'where 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 '') +' '\ @@ -272,7 +271,6 @@ class product_product(osv.osv): '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 '') + ' '\