From 69686efcd536de68762c15b0e2d14476aad560f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Lef=C3=A8vre?= Date: Tue, 31 Mar 2020 07:22:11 +0000 Subject: [PATCH] [IMP] hr_timesheet: Round timesheet when created from timer Because. Mighty PO said: "We'll need this in internal" Don't ask me, it's changing every two days. Task 2204084 closes odoo/odoo#48097 Related: odoo/enterprise#9394 Signed-off-by: Yannick Tivisse (yti) --- addons/hr_timesheet/models/hr_timesheet.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/hr_timesheet/models/hr_timesheet.py b/addons/hr_timesheet/models/hr_timesheet.py index 0e206e27d25..028d411ea1b 100644 --- a/addons/hr_timesheet/models/hr_timesheet.py +++ b/addons/hr_timesheet/models/hr_timesheet.py @@ -224,6 +224,9 @@ class AccountAnalyticLine(models.Model): if minutes_spent < 1: amount = self.unit_amount else: + minimum_duration = int(self.env['ir.config_parameter'].sudo().get_param('hr_timesheet.timesheet_min_duration', 0)) + rounding = int(self.env['ir.config_parameter'].sudo().get_param('hr_timesheet.timesheet_rounding', 0)) + minutes_spent = self._timer_rounding(minutes_spent, minimum_duration, rounding) amount = self.unit_amount + minutes_spent * 60 / 3600 self.write({'unit_amount': amount})