Hi everybody.
I need to display values from one2many field in tree view, so I decided to create functional field and declared it on my xml tree view:
def get_product_brands(self, cr, uid, ids, fields, arg, context):
res={}
for record in self.browse(cr, uid, ids, context=None).application_data_product_template_ids:
brands = record.brand.name or ''
print brands
res[record.id] = brands
return res
and my field declaration:
'brands' : fields.function(get_product_brands, method=True, string="Product brands", type='char', store=True)
xml sample code:
<record model="ir.ui.view" id="product_tree_inherit">
<field name="name">product.tree.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='categ_id']" position="after">
<field name="brands"/>
</xpath>
</field>
</record>
In my console, I can see correct records printed but I does not display anything in my tree view.
Can anyone help me?