summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorjem-odoo <jem@openerp.com>2018-05-30 11:16:13 +0200
committerjem-odoo <jem@openerp.com>2018-05-30 16:22:45 +0200
commit7f736f8db6863c4a04409c0d4aed8b9154a57aba (patch)
tree203c4bc0545164e6e3466a50911b83797573e761 /addons
parented0202df1856538e39373851e73094faef3e83ec (diff)
[FIX] hr_timesheet: avoid rounding error
When adding a timesheet with a number of minute that has many decimal (once converted into float), the planned_hours field might be recomputed. So, it might be a rounding error during this recomputation, making the field value change. Since this field is tracked, a message is post in chatter (like Planned Hours: 50 -> 50.0033333"), which is not useful ... opw-1849693
Diffstat (limited to 'addons')
-rw-r--r--addons/hr_timesheet/models/project.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/hr_timesheet/models/project.py b/addons/hr_timesheet/models/project.py
index c88aa12c864..4b36df78e61 100644
--- a/addons/hr_timesheet/models/project.py
+++ b/addons/hr_timesheet/models/project.py
@@ -30,7 +30,7 @@ class Task(models.Model):
@api.depends('timesheet_ids.unit_amount')
def _compute_effective_hours(self):
for task in self:
- task.effective_hours = sum(task.timesheet_ids.mapped('unit_amount'))
+ task.effective_hours = round(sum(task.timesheet_ids.mapped('unit_amount')), 2)
@api.depends('effective_hours', 'subtask_effective_hours', 'planned_hours')
def _compute_progress_hours(self):