From a0af92fee3d4c67da82b532698af722aadcd2613 Mon Sep 17 00:00:00 2001 From: "Abdelouahab (abla)" Date: Tue, 8 Feb 2022 15:11:45 +0000 Subject: [PATCH] [FIX] hr: Fix timezone issue on last_activity_time computation Purpose ======= for example: in Europe/Brussels timezone, the presence hour of an employee using this timezone is up with one hour. The issue is that we give a localized time to format_time pretending it's not (removing the tzinfo), so it's converted twice. Specification ============= To solve the issue, just give the time in UTC to format_time. opw-2741634 closes odoo/odoo#85510 X-original-commit: 8953eb2e387bd046c586e815c10c1e30b00db13d Signed-off-by: Yannick Tivisse (yti) --- addons/hr/models/hr_employee_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr/models/hr_employee_base.py b/addons/hr/models/hr_employee_base.py index d0329245d8e..32cb4c3ff72 100644 --- a/addons/hr/models/hr_employee_base.py +++ b/addons/hr/models/hr_employee_base.py @@ -125,7 +125,7 @@ class HrEmployeeBase(models.AbstractModel): last_activity_datetime = last_presence.replace(tzinfo=UTC).astimezone(timezone(tz)).replace(tzinfo=None) employee.last_activity = last_activity_datetime.date() if employee.last_activity == fields.Date.today(): - employee.last_activity_time = format_time(self.env, last_activity_datetime, time_format='short') + employee.last_activity_time = format_time(self.env, last_presence, time_format='short') else: employee.last_activity_time = False else: