This question has been flagged
3014 Views

Hello everybody,

I try to have a tree (with a line for each result) with all the product_bat which the name is not null

 My code: 

def _bat_names(self, cr, uid,ids, fields,args, context): 
bat_pool = self.pool.get('product.bat') 
bat_ids = bat_pool.search(cr,uid,[('name','!=','')]) 
bat_names = [(0, 0, {'name':bat.name}) for bat in bat_pool.browse(cr, uid, bat_ids)] 
res=dict([(m_id, bat_names) for m_id in ids]) 
return res 

'bat_names': fields.function(_bat_names, type='many2many', relation='product.bat', string='BAT Names') 

<field name="bat_names/">

But I have this error:

Object # has no method 'slice' OpenERP

Someone know why please?

Thank you a lot,

Selverine

Avatar
Discard