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:
'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:
'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()
uom_obj = self.pool.get('product.uom')