[6.1/trunk] Slow product price list

Bug #1015450 reported by kurt
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Confirmed
Low
OpenERP R&D Addons Team 2

Bug Description

Hey,

Fetching a product list (80) based on a pricelist, it's slow because of the the amount of product categories.

Ex.
- All Product
- Import Supp001 Category
- Import Supp002 Category
- Import Supp003 Category
- Import Supp004 Category
==> with around a total of 2400 categories

in product/pricelist.py
 --> function "price_get_multi" > line 185:

     # product.category:
     product_category_ids = product_category_obj.search(cr, uid, [])
     product_categories = product_category_obj.read(cr, uid, product_category_ids, ['parent_id'])
     product_category_tree = dict([(item['id'], item['parent_id'][0]) for item in product_categories if item['parent_id']])

==> this will always fetch all categories for each product in the list and is used to get the parents categories of the product
         which is used then in "_create_parent_category_list" (line 137) and slow downs the list.

Possible fix is:
 We have then disabled the full search of the categories and rewrite the "_create_parent_category_list" function;
 >>>
 def _create_parent_category_list( categ_id, lst ):
  if not categ_id:
   return []
  category = product_category_obj.browse( cr, uid, categ_id )
  if category.parent_id:
   lst.append( category.parent_id.id )
               return _create_parent_category_list( category.parent_id.id, lst )
  return lst
  # _create_parent_category_list

 maybe not the best solution, but we go from 15sec -> 1.4 sec for fetching the list.

RevNo:
- Addons : 6850
- Web : 2364
- Server : 4212

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello,

Yes, I agreed We have to use browse instead on search/read. It fetches all the record.Also it's not a blocking point that's why I am assigning this as a "low" importance.

Thanks!

summary: - [6.1] Slow product price list
+ [6.1/trunk] Slow product price list
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 2 (openerp-dev-addons2)
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Soluntec (soluntec) wrote :

Hi ... I have the same problem.. In my system with 200 categories with 4 levels, the system performance is really really bad..

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.