From d202c163acf9986e137b5d23ecdbc34271e72ec2 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 14:01:19 +0530 Subject: [PATCH] fix(Shift Attendance): conversion of datetime to time for same date for None values (backport #1345) (#1391) (cherry picked from commit f52fd555ca904e5dbbb4946e5498c32b04bb8822) Co-authored-by: Akash Tom <61287991+krantheman@users.noreply.github.com> --- hrms/hr/report/shift_attendance/shift_attendance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hrms/hr/report/shift_attendance/shift_attendance.py b/hrms/hr/report/shift_attendance/shift_attendance.py index 479a6b73b0..3263747647 100644 --- a/hrms/hr/report/shift_attendance/shift_attendance.py +++ b/hrms/hr/report/shift_attendance/shift_attendance.py @@ -288,13 +288,13 @@ def format_in_out_time(in_time, out_time, attendance_date): in_time = in_time.time() elif out_time and not in_time and out_time.date() == attendance_date: out_time = out_time.time() - elif in_time and out_time: + else: in_time, out_time = convert_datetime_to_time_for_same_date(in_time, out_time) return in_time, out_time def convert_datetime_to_time_for_same_date(start, end): - if start.date() == end.date(): + if start and end and start.date() == end.date(): start = start.time() end = end.time() else: