I'm going mad with this one (or, perhaps, just going dumber):
I need to override the name_get method of project.task
It's not really important what I want to do (or if the code is clumsy), but to focus on this one annoying thing: the system totally ignores my function and it keeps calling the old (original) one.
Here's the code:
class project_task(osv.osv):
_inherit = 'project.task'
def name_get(self, cr, uid, ids, context=None):
if context is None:
context = {}
if not ids:
return []
aux=''
for r in self.read(cr, uid, ids, ['id', 'date_start', 'date_end', 'name'], context):
if r['name']:
aux=r['name']
else:
aux=_(r['id'])
aux=aux + ' ('
if r['date_start']:
aux=aux + _(r['date_start'])
aux=aux + ' - '
if r['date_end']:
aux=aux + _(r['date_end'])
aux=aux + ')'
res=(r['id'], aux)
super(project_task, self).name_get(cr, uid, ids, context=context)
return aux
project_task()
Why???? :)