[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
This commit is contained in:
Nicolas Martinelli
2016-07-05 13:33:41 +02:00
parent f7263dac30
commit 11199d2cc2
@@ -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)