[FIX] website_sale: very slow name_get for product public categories
This commit is contained in:
parent
8d9cfd7321
commit
010dd5a603
|
@ -46,15 +46,14 @@ class product_public_category(osv.osv):
|
||||||
]
|
]
|
||||||
|
|
||||||
def name_get(self, cr, uid, ids, context=None):
|
def name_get(self, cr, uid, ids, context=None):
|
||||||
if not len(ids):
|
|
||||||
return []
|
|
||||||
reads = self.read(cr, uid, ids, ['name','parent_id'], context=context)
|
|
||||||
res = []
|
res = []
|
||||||
for record in reads:
|
for cat in self.browse(cr, uid, ids, context=context):
|
||||||
name = record['name']
|
names = [cat.name]
|
||||||
if record['parent_id']:
|
pcat = cat.parent_id
|
||||||
name = record['parent_id'][1]+' / '+name
|
while pcat:
|
||||||
res.append((record['id'], name))
|
names.append(pcat.name)
|
||||||
|
pcat = pcat.parent_id
|
||||||
|
res.append((cat.id, ' / '.join(reversed(names))))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
|
def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
|
||||||
|
|
Loading…
Reference in New Issue