Merge lp:~openerp-dev/openobject-addons/6.1-opw-50947-ado into lp:openobject-addons/6.1

Proposed by Amit Dodiya (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-50947-ado
Merge into: lp:openobject-addons/6.1
Diff against target: 24 lines (+9/-4)
1 file modified
stock/product.py (+9/-4)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-50947-ado
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Review via email: mp+123889@code.launchpad.net

Description of the change

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

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello,

This bug was qualified as Already Fixed on Trunk (means that it was already fixed and merged in Trunk). If this Merge Proposal could not be merged in v6.1 at the release of v7.0, it will be closed.

Thanks,
Naresh Soni

Unmerged revisions

6987. By Amit Dodiya<email address hidden>

[BACKPORT] [FIX] stock: improve speed of product's stock quantity/value calculation

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/product.py'
2--- stock/product.py 2012-06-19 07:40:07 +0000
3+++ stock/product.py 2012-09-12 06:20:27 +0000
4@@ -224,11 +224,16 @@
5
6 # this will be a dictionary of the UoM resources we need for conversion purposes, by UoM id
7 uoms_o = {}
8- # this will be a dictionary of the product UoM by product id
9+ uoms_ids = {}
10 product2uom = {}
11- for product in self.browse(cr, uid, ids, context=context):
12- product2uom[product.id] = product.uom_id.id
13- uoms_o[product.uom_id.id] = product.uom_id
14+ for product in self.read(cr, uid, ids, ['uom_id'], context=context):
15+ product_uom_id = product['uom_id'][0] # uom id is required!
16+ product2uom[product['id']] = product_uom_id
17+ uoms_ids[product_uom_id] = True
18+
19+ uom_obj = self.pool.get('product.uom')
20+ for uom in uom_obj.browse(cr, uid, uoms_ids.keys(), context=context):
21+ uoms_o[uom.id] = uom
22
23 results = []
24 results2 = []