Hi,
I've been struggling for some time now with the following function, which belongs to the product.category class. I understand what it's trying to accomplish, but I don't understand the whole code:
def name_get(self, cr, uid, ids, context=None):
if isinstance(ids, (list, tuple)) and not len(ids):
return []
if isinstance(ids, (long, int)):
ids = [ids]
reads = self.read(cr, uid, ids, ['name','parent_id'], context=context)
res = []
for record in reads:
name = record['name']
if record['parent_id']:
name = record['parent_id'][1]+' / '+name
res.append((record['id'], name))
return res
This is liked I guess to the following question:
https://www.odoo.com/forum/help-1/question/product-category-parent-id-parent-left-parent-right-30007
I understand the concept but I don't get how everything is linked together, specially the next sentence:
name = record['parent_id'][1]+' / '+name
It may seem a basic question but I'd appreciate any help on this.
Thanks in advance.