Skip to content
Snippets Groups Projects
Commit 2beaa78d authored by Audric Onockx (auon)'s avatar Audric Onockx (auon)
Browse files

[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: default avatarLaurent Stukkens (ltu) <ltu@odoo.com>
Signed-off-by: default avatarOnockx Audric (auon) <auon@odoo.com>
parent 1412c6ed
Branches
Tags
No related merge requests found
......@@ -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}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment