From 67c7d45ea83164253534bbc31e9c744ac1a54ff5 Mon Sep 17 00:00:00 2001 From: Tanguy Charlier Date: Tue, 12 Apr 2016 14:14:15 +0200 Subject: [PATCH] [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 --- addons/project_timesheet/project_timesheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 54a4a2a3b84..1d7531c7810 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -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