From 9682c2b11a574999623db13dafd99dc7cf357b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 3 Apr 2012 12:18:46 +0200 Subject: [PATCH] Fix order_points usage in get_shortage review318001 --- purchase_request.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/purchase_request.py b/purchase_request.py index 62ac19628b..835636a12a 100644 --- a/purchase_request.py +++ b/purchase_request.py @@ -417,8 +417,13 @@ class PurchaseRequest(ModelSQL, ModelView): res_dates = {} res_qties = {} - min_quantities = dict((x, order_points.get(x, 0.0)) - for x in product_ids) + min_quantities = {} + for product_id in product_ids: + order_point = order_points.get((location_id, product_id)) + if order_point: + min_quantities[product_id] = order_point.min_quantity + else: + min_quantities[product_id] = 0.0 current_date = min_date current_qties = min_date_qties.copy()