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
This commit is contained in:
Cédric Krier committed 2012-07-25 20:42:55 +02:00
1 parent 67ceb5b999
commit ac024eb0cb
1 file changed
+2 -1
+2 -1
View File
@@ -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):