From ac024eb0cb4bc666a93a6768db7672f069858153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 25 Jul 2012 20:42:55 +0200 Subject: [PATCH] Use sorted products when generating purchase request As product ids will be used many time to compute stock reduce_ids will be apply many times, So having the list already sorted make it faster to sort it again. review426001 --- purchase_request.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/purchase_request.py b/purchase_request.py index cd7ca91cbf..c415656f86 100644 --- a/purchase_request.py +++ b/purchase_request.py @@ -166,11 +166,12 @@ class PurchaseRequest(ModelSQL, ModelView): ] = order_point # fetch goods + # ordered by ids to speedup reduce_ids in products_by_location product_ids = product_obj.search([ ('type', '=', 'goods'), ('consumable', '=', False), ('purchasable', '=', True), - ]) + ], order=[('id', 'ASC')]) #aggregate product by minimum supply date date2products = {} for product in product_obj.browse(product_ids):