[FIX] Correct Stock Level Forecast report
authorJosse Colpaert <jco@openerp.com>
Mon, 17 Mar 2014 15:22:13 +0000 (16:22 +0100)
committerJosse Colpaert <jco@openerp.com>
Mon, 17 Mar 2014 15:22:13 +0000 (16:22 +0100)
bzr revid: jco@openerp.com-20140317152213-iiknesh2j3qppjdi

addons/stock/report/product_stock.py

index db6ac9b..b899436 100644 (file)
@@ -66,11 +66,13 @@ class report_stock(report_int):
         for name in names:
             names[name] = names[name].encode('utf8')
         products = {}
-        prods = registry['stock.location']._product_all_get(cr, uid, location_id, product_ids)
+        ctx = context.copy()
+        ctx['location_id'] = loc_ids
+        prods = registry['product.product']._product_available(cr, uid, product_ids, context=ctx)
+        for prod in prods.keys():
+            products[prod] = [(now, prods[prod]['qty_available'])]
+            prods[prod] = 0
 
-        for p in prods:
-            products[p] = [(now,prods[p])]
-            prods[p] = 0
 
         if not loc_ids or not product_ids:
             return (False, 'pdf')