From 5c2714371158b752c8a8d93de7cffd02cb259f6f Mon Sep 17 00:00:00 2001 From: blackbelts <74664702+eslamtalaat74@users.noreply.github.com> Date: Tue, 8 Jul 2025 10:24:21 +0300 Subject: [PATCH 1/2] fix get_speacial_day_timing error --- .../models/hr_attendance_transactions.py | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/odex25_hr/attendances/models/hr_attendance_transactions.py b/odex25_hr/attendances/models/hr_attendance_transactions.py index fde56b8ef..973674de1 100644 --- a/odex25_hr/attendances/models/hr_attendance_transactions.py +++ b/odex25_hr/attendances/models/hr_attendance_transactions.py @@ -412,16 +412,34 @@ class HrAttendanceTransactions(models.Model): time_list[7] = two_sp_timing and two_sp_timing.end_sign_out or calendar.shift_two_max_sign_out return time_list, planed_hours + # def get_speacial_day_timing(self, calender, weekday, at_date, shift=None): + # sp_days = shift and calender.special_days_partcial or calender.special_days + # for spday in sp_days: + # if spday.name.lower() == weekday and ((shift and spday.shift == shift) or (not shift and True)): + # if spday.date_from and spday.date_to \ + # and str(at_date) >= spday.date_from and str(at_date) <= spday.date_to: + # return spday + # elif spday.date_from and not spday.date_to and str(at_date) >= spday.date_from: + # return spday + # elif not spday.date_from and spday.date_to and str(at_date) <= spday.date_to: + # return spday + # elif not spday.date_from and not spday.date_to: + # return spday + def get_speacial_day_timing(self, calender, weekday, at_date, shift=None): + # Ensure at_date is a date object + if isinstance(at_date, str): + # Adjust the format string to match your date string format + at_date = datetime.strptime(at_date, "%Y-%m-%d").date() sp_days = shift and calender.special_days_partcial or calender.special_days for spday in sp_days: if spday.name.lower() == weekday and ((shift and spday.shift == shift) or (not shift and True)): if spday.date_from and spday.date_to \ - and str(at_date) >= spday.date_from and str(at_date) <= spday.date_to: + and at_date >= spday.date_from and at_date <= spday.date_to: return spday - elif spday.date_from and not spday.date_to and str(at_date) >= spday.date_from: + elif spday.date_from and not spday.date_to and at_date >= spday.date_from: return spday - elif not spday.date_from and spday.date_to and str(at_date) <= spday.date_to: + elif not spday.date_from and spday.date_to and at_date <= spday.date_to: return spday elif not spday.date_from and not spday.date_to: return spday From 41f7be68bd4ae885ab620d27cb10f8ea809783f3 Mon Sep 17 00:00:00 2001 From: blackbelts <74664702+eslamtalaat74@users.noreply.github.com> Date: Tue, 8 Jul 2025 10:41:03 +0300 Subject: [PATCH 2/2] modify on contract view --- .../hr_contract_custom/views/contract_view.xml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/odex25_hr/hr_contract_custom/views/contract_view.xml b/odex25_hr/hr_contract_custom/views/contract_view.xml index 154899858..09ce31565 100644 --- a/odex25_hr/hr_contract_custom/views/contract_view.xml +++ b/odex25_hr/hr_contract_custom/views/contract_view.xml @@ -11,9 +11,12 @@
+ + +
@@ -288,6 +294,7 @@ > +