[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) <yti@odoo.com>
This commit is contained in:
Abdelouahab (abla)
2022-02-28 13:53:39 +00:00
parent a1945fea71
commit a0af92fee3
+1 -1
View File
@@ -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: