openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #13377
[Bug 1015450] Re: [6.1/trunk] Slow product price list
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 changed:
- [6.1] Slow product price list
+ [6.1/trunk] Slow product price list
** Changed in: openobject-addons
Importance: Undecided => Low
** Changed in: openobject-addons
Status: New => Confirmed
** Changed in: openobject-addons
Assignee: (unassigned) => OpenERP R&D Addons Team 2 (openerp-dev-addons2)
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1015450
Title:
[6.1/trunk] Slow product price list
Status in OpenERP Addons (modules):
Confirmed
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
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1015450/+subscriptions
References