[FIX] stock: put check to be able to find product qty with prodlot_id=False
authorRifakat <rha@tinyerp.com>
Thu, 5 Jul 2012 08:27:08 +0000 (13:57 +0530)
committerRifakat <rha@tinyerp.com>
Thu, 5 Jul 2012 08:27:08 +0000 (13:57 +0530)
bzr revid: rha@tinyerp.com-20120705082708-87buh8m7kexrvk2p

1  2 
addons/stock/product.py

@@@ -248,16 -248,12 +248,18 @@@ class product_product(osv.osv)
          elif to_date:
              date_str = "date<=%s"
              date_values = [to_date]
 +        if date_values:
 +            where.append(tuple(date_values))
  
          prodlot_id = context.get('prodlot_id', False)
 +        prodlot_clause = ''
 +        if prodlot_id:
 +            prodlot_clause = ' and prodlot_id = %s '
 +            where += [prodlot_id]
++        elif 'prodlot_id' in context and not prodlot_id:
++            prodlot_clause = 'and prodlot_id is null '
  
 -    # TODO: perhaps merge in one query.
 -        if date_values:
 -            where.append(tuple(date_values))
 +        # TODO: perhaps merge in one query.
          if 'in' in what:
              # all moves from a location out of the set to a location in the set
              cr.execute(