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
=== 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 @@
224 224
225 # this will be a dictionary of the UoM resources we need for conversion purposes, by UoM id225 # this will be a dictionary of the UoM resources we need for conversion purposes, by UoM id
226 uoms_o = {}226 uoms_o = {}
227 # this will be a dictionary of the product UoM by product id227 uoms_ids = {}
228 product2uom = {}228 product2uom = {}
229 for product in self.browse(cr, uid, ids, context=context):229 for product in self.read(cr, uid, ids, ['uom_id'], context=context):
230 product2uom[product.id] = product.uom_id.id230 product_uom_id = product['uom_id'][0] # uom id is required!
231 uoms_o[product.uom_id.id] = product.uom_id231 product2uom[product['id']] = product_uom_id
232 uoms_ids[product_uom_id] = True
233
234 uom_obj = self.pool.get('product.uom')
235 for uom in uom_obj.browse(cr, uid, uoms_ids.keys(), context=context):
236 uoms_o[uom.id] = uom
232237
233 results = []238 results = []
234 results2 = []239 results2 = []