Add stock_supply_production-performance-improvement.diff

This commit is contained in:
Guillem Barba 2015-04-15 17:58:43 +02:00
parent ae03c5c4c4
commit f5c2975fb5
2 changed files with 32 additions and 0 deletions

1
series
View File

@ -45,3 +45,4 @@ issue6951002_20001.diff
issue92001_42002_52002_wsgi_protocol.diff
check-vies-issue12101002.patch
stock_supply_production-performance-improvement.diff

View File

@ -0,0 +1,31 @@
diff -r 4af84eb4246d product.py
--- a/product.py Tue Feb 17 21:08:47 2015 +0100
+++ b/product.py Wed Apr 15 17:57:32 2015 +0200
@@ -10,8 +10,10 @@
class Product:
__name__ = 'product.product'
- def get_supply_period(self):
- 'Return the supply period for the product'
+ @classmethod
+ def get_supply_periods(cls, products):
+ 'Return the supply period for each product'
pool = Pool()
Configuration = pool.get('production.configuration')
- return int(Configuration(1).supply_period or 0)
+ supply_period = int(Configuration(1).supply_period or 0)
+ return dict((p, supply_period) for p in products)
diff -r 4af84eb4246d production.py
--- a/production.py Tue Feb 17 21:08:47 2015 +0100
+++ b/production.py Wed Apr 15 17:57:32 2015 +0200
@@ -87,8 +87,8 @@
product_ids, with_childs=True)
# order product by supply period
- products_period = sorted((p.get_supply_period(), p)
- for p in sub_products)
+ products_period = sorted((sp, p) for p, sp
+ in Product.get_supply_periods(sub_products).iteritems())
for warehouse in warehouses:
quantities = dict((x, pbl.pop((warehouse.id, x), 0))