Hi, I'm using fields_view_get method for overriding a treeview, every thing is fine but when I try to get the active_id to return the value of the current record, it returns False, this is my code :
class res_partner(osv.osv):
_inherit = 'res.partner'
def fields_view_get(self, cr, uid, view_id=None, view_type='tree', context=None, toolbar=False, submenu=False):
if context is None:
context = {}
res = super(res_partner,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
partner_obj = self.pool.get('res.partner')
active_id = context.get('active_id', False)
partner_name = partner_obj.browse(cr, uid, active_id, context=context).numcte
partner_icon = partner_name
print partner_icon
print active_id
doc = etree.XML(res['arch'])
if view_type == 'tree':
for node in doc.xpath("//button[@name='icono']"):
node.set('icon', partner_icon)
res['arch'] = etree.tostring(doc)
return res
_columns = {
'numcte': fields.text('numero cliente'),
}
res_partner()
thanks, for your advice.