From 2beaa78d3097b85e0d65f3cb7db215236be69616 Mon Sep 17 00:00:00 2001 From: "Audric Onockx (auon)" Date: Mon, 25 Apr 2022 10:20:18 +0000 Subject: [PATCH] [FIX] hr_timesheet : round hour spent correctly Steps : Install project and activate Timesheets. Go to a task and add a timesheet with 30', then click elsewhere. Issue : The hours spent adapts, rounding to integer. Cause : The digits are not specified. Fix : Specify them. opw-2822018 closes odoo/odoo#89596 X-original-commit: 307f403156f20e56fe91cad5397b3db1b3ae3f99 Signed-off-by: Laurent Stukkens (ltu) Signed-off-by: Onockx Audric (auon) --- addons/hr_timesheet/models/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet/models/project.py b/addons/hr_timesheet/models/project.py index 2afc6d6f154..edab491a5d1 100644 --- a/addons/hr_timesheet/models/project.py +++ b/addons/hr_timesheet/models/project.py @@ -280,7 +280,7 @@ class Task(models.Model): def _compute_effective_hours(self): if not any(self._ids): for task in self: - task.effective_hours = round(sum(task.timesheet_ids.mapped('unit_amount'))) + task.effective_hours = round(sum(task.timesheet_ids.mapped('unit_amount')), 2) return timesheet_read_group = self.env['account.analytic.line'].read_group([('task_id', 'in', self.ids)], ['unit_amount', 'task_id'], ['task_id']) timesheets_per_task = {res['task_id'][0]: res['unit_amount'] for res in timesheet_read_group}