Learning Python and trying to understand the new odoo API has been a challenge to me.
how to I convert this method to new API? this will help me a lot in my attempt to grasp new API concept
def name_get(self, cr, uid, ids, context={}):
if not len(ids):
return []
reads = self.read(cr, uid, ids, ['name', 'lastname'], context)
res = []
for record in reads:
name = record['name']
if record['lastname']:
name = record['lastname'] + ', '+name
res.append((record['id'], name))
return res
the method read name and lastname from res.partner
and append Id value to the name as return.