[FIX] stock: properly pass production lot number as SQL query parameter
lp bug: https://launchpad.net/bugs/1014759 fixed bzr revid: odo@openerp.com-20120618174153-kx2hcqv2wq7bhf3c
This commit is contained in:
parent
125fb808f4
commit
acc0a0a4c2
|
@ -250,6 +250,10 @@ class product_product(osv.osv):
|
|||
date_values = [to_date]
|
||||
|
||||
prodlot_id = context.get('prodlot_id', False)
|
||||
prodlot_clause = ''
|
||||
if prodlot_id:
|
||||
prodlot_clause = ' and prodlot_id = %s '
|
||||
where += [prodlot_id]
|
||||
|
||||
# TODO: perhaps merge in one query.
|
||||
if date_values:
|
||||
|
@ -262,8 +266,8 @@ class product_product(osv.osv):
|
|||
'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 '') +' '\
|
||||
+ prodlot_clause +
|
||||
'group by product_id,product_uom',tuple(where))
|
||||
results = cr.fetchall()
|
||||
if 'out' in what:
|
||||
|
@ -274,8 +278,8 @@ class product_product(osv.osv):
|
|||
'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 '') + ' '\
|
||||
+ prodlot_clause +
|
||||
'group by product_id,product_uom',tuple(where))
|
||||
results2 = cr.fetchall()
|
||||
|
||||
|
|
Loading…
Reference in New Issue