[FIX] project_timesheet: Missing 'fields' argument in search_read

* It is always better to restrict the read to the fields that are actually needed
* In this particular case, since _get_task is called during the create() of an an analytic line with task_id set,
it would result in reading the analytic line being created, which will overwrite the cache for stored computed fields with wrong empty values.
Restricting the fields to read means that computed fields are not read and keep their appropriate values
This commit is contained in:
Tanguy Charlier
2016-04-22 13:44:57 +02:00
parent d29ca90c75
commit 67c7d45ea8
@@ -68,7 +68,7 @@ class task(osv.osv):
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):
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