Skip to Content
Menu
This question has been flagged

I was getting traceback error while filling timesheet. After R&D I came to know that it was the issue of Odoo’s code it self. I compared code with the latest one and found the issue.

The Problem:

The method is called from function field. I have overridden it successfully but the problem is, after overriding it, it is calling first the original method of Odoo and after that, it is calling my overridden method. That’s why I am facing the same traceback error.

Here is default code:

def _get_task(self, cr, uid, id, context=None):

  res = []

  for line in self.pool.get('account.analytic.line').search_read(cr,uid,[('task_id', '!=', False),('id','in',id)], context=context):

      res.append(line['task_id'][0])

  return res


Here is my overridden code after bug fixed by Odoo:

def _get_task(self, cr, uid, id, context=None):

  res = []

     for line in self.pool.get('account.analytic.line').search_read(cr, uid,[('task_id', '!=', False), ('id', 'in', id)], ['task_id'], context=context):

      res.append(line['task_id'][0])

  return res

The only difference between these two is the [‘task_id’] which is added in the search_read method. Can anybody help me out regarding it?

Avatar
Discard
Related Posts Replies Views Activity
0
Oct 24
237
1
Apr 19
6306
0
May 16
2523
2
Dec 15
3482
2
Oct 21
2458