From 2cb194e1b51969e4c27e5877620296977ec09b90 Mon Sep 17 00:00:00 2001 From: Barad Mahendra Date: Fri, 21 Aug 2020 06:07:49 +0000 Subject: [PATCH] [FIX] hr_attendance: Fix traceback on creation of employee Currently, when you create a employee when hr_aattance is installed then it will create traceback due to falder timiezone so in this commit, Fix the issue and if timezone is not set on employee then pass the 'UTC' TaskID: 2283753 --- addons/hr_attendance/models/hr_employee.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_attendance/models/hr_employee.py b/addons/hr_attendance/models/hr_employee.py index bb67506dbb9..0f65f37251e 100644 --- a/addons/hr_attendance/models/hr_employee.py +++ b/addons/hr_attendance/models/hr_employee.py @@ -42,7 +42,7 @@ class HrEmployeeBase(models.AbstractModel): now = fields.Datetime.now() now_utc = pytz.utc.localize(now) for employee in self: - tz = pytz.timezone(employee.tz) + tz = pytz.timezone(employee.tz or 'UTC') now_tz = now_utc.astimezone(tz) start_tz = now_tz + relativedelta(months=-1, day=1, hour=0, minute=0, second=0, microsecond=0) start_naive = start_tz.astimezone(pytz.utc).replace(tzinfo=None)