Compute products_period only for current products

get_shortage expect to receive products_period only for product_ids.

issue2905
review595005
This commit is contained in:
Cédric Krier committed 2012-12-05 13:38:59 +01:00
1 parent 4d070d64ab
commit 4d089e1439
1 file changed
+5 -4
+5 -4
View File
@@ -70,10 +70,6 @@ class Production:
('consumable', '=', False),
('purchasable', '=', False),
])
# order product by supply period
products_period = sorted([(p.get_supply_period(), p)
for p in products])
# compute requests
cursor = Transaction().cursor
today = Date.today()
@@ -84,6 +80,11 @@ class Production:
stock_date_end=today):
pbl = Product.products_by_location(warehouse_ids,
product_ids, with_childs=True, skip_zero=False)
# order product by supply period
products_period = sorted([(p.get_supply_period(), p)
for p in products[i:i + cursor.IN_MAX]])
for warehouse in warehouses:
quantities = dict((x, pbl.pop((warehouse.id, x)))
for x in product_ids)