Amit Dodiya (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.1-opw-50947-ado into
lp:openobject-addons/6.1.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-50947-ado/+merge/123889
Hello,
"[FORWARD-PORT] stock: improve speed of product's stock quantity/value
calculation"
When we have thousands of products and hundreds of locations in a
multicompany environment.
When we go to a locations, the openerp server process increases the cpu
usage to more than 100%. The same problem happens when we run locations or
products
reports.
Code is forward-ported from 6.0.
Regards,
Amit Dodiya
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-50947-ado/+merge/123889
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.1-opw-50947-ado.
=== modified file 'stock/product.py'
--- stock/product.py 2012-06-19 07:40:07 +0000
+++ stock/product.py 2012-09-12 06:20:27 +0000
@@ -224,11 +224,16 @@
# this will be a dictionary of the UoM resources we need for conversion purposes, by UoM id
uoms_o = {}
- # this will be a dictionary of the product UoM by product id
+ uoms_ids = {}
product2uom = {}
- for product in self.browse(cr, uid, ids, context=context):
- product2uom[product.id] = product.uom_id.id
- uoms_o[product.uom_id.id] = product.uom_id
+ for product in self.read(cr, uid, ids, ['uom_id'], context=context):
+ product_uom_id = product['uom_id'][0] # uom id is required!
+ product2uom[product['id']] = product_uom_id
+ uoms_ids[product_uom_id] = True
+
+ uom_obj = self.pool.get('product.uom')
+ for uom in uom_obj.browse(cr, uid, uoms_ids.keys(), context=context):
+ uoms_o[uom.id] = uom
results = []
results2 = []
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp