From 4d089e143960adaead7592c86de9de87f5cba945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 5 Dec 2012 13:38:59 +0100 Subject: [PATCH] Compute products_period only for current products get_shortage expect to receive products_period only for product_ids. issue2905 review595005 --- production.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/production.py b/production.py index 0871d1948f..b55704dfb6 100644 --- a/production.py +++ b/production.py @@ -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)