[FIX]move domain check in _quants_get_order
[odoo/odoo.git] / addons / stock / stock.py
index de26228..d954042 100644 (file)
@@ -538,6 +538,9 @@ class stock_quant(osv.osv):
         '''
         domain += location and [('location_id', 'child_of', location.id)] or []
         domain += [('product_id', '=', product.id)] + domain
+        #don't take into account location that are production, supplier or inventory
+        ignore_location_ids = self.pool.get('stock.location').search(cr, uid, [('usage', 'in', ('production', 'supplier', 'inventory'))], context=context)
+        domain.append(('location_id','not in',ignore_location_ids))
         res = []
         offset = 0
         while quantity > 0:
@@ -1173,8 +1176,6 @@ class stock_production_lot(osv.osv):
         @param context: A standard dictionary
         @return: A dictionary of values
         """
-        if not ids or len(ids) == 0:
-            return False #TODO give warning instead
         quant_obj = self.pool.get("stock.quant")
         move_obj = self.pool.get("stock.move")
         quants = quant_obj.search(cr, uid, [('lot_id', 'in', ids)], context=context)