From 11199d2cc2e721bbce96278cf7f629fe6211492c Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 5 Jul 2016 13:33:41 +0200 Subject: [PATCH] [FIX] project_timesheet: task progress is no timesheet If a project task with no linked timesheet is set to "Done", the working time progress stays to zero. opw-681622 --- addons/project_timesheet/project_timesheet.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 1d7531c7810..6b53703dcdc 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -51,7 +51,13 @@ class task(osv.osv): def _hours_get(self, cr, uid, ids, field_names, args, context=None): res = {} for task in self.browse(cr, uid, ids, context=context): - res[task.id] = {'effective_hours': 0.0, 'remaining_hours': task.planned_hours, 'progress': 0.0, 'total_hours': task.planned_hours, 'delay_hours': 0.0} + res[task.id] = { + 'effective_hours': 0.0, + 'remaining_hours': task.planned_hours, + 'progress': 100.0 if task.stage_id and task.stage_id.fold else 0.0, + 'total_hours': task.planned_hours, + 'delay_hours': 0.0, + } tasks_data = self.pool['account.analytic.line'].read_group(cr, uid, [('task_id', 'in', ids)], ['task_id','unit_amount'], ['task_id'], context=context) for data in tasks_data: task = self.browse(cr, uid, data['task_id'][0], context=context)