From deb5a6f74bff31f7d6b5b09010f1d64fbd4e53d8 Mon Sep 17 00:00:00 2001 From: Bakry Date: Mon, 17 Nov 2025 16:13:32 +0300 Subject: [PATCH 1/3] fix leave status in employee --- odex25_hr/hr_holidays_community/models/hr.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/odex25_hr/hr_holidays_community/models/hr.py b/odex25_hr/hr_holidays_community/models/hr.py index 1c14a2ae1..b824ad85f 100644 --- a/odex25_hr/hr_holidays_community/models/hr.py +++ b/odex25_hr/hr_holidays_community/models/hr.py @@ -142,10 +142,11 @@ class Employee(models.Model): def _compute_leave_status(self): # Used SUPERUSER_ID to forcefully get status of other user's leave, to bypass record rule + today_now = fields.Datetime.to_datetime(fields.Date.today()) holidays = self.env['hr.holidays'].sudo().search([ ('employee_id', 'in', self.ids), - ('date_from', '<=', fields.Datetime.now()), - ('date_to', '>=', fields.Datetime.now()), + ('date_from', '<=', today_now), + ('date_to', '>=', today_now), ('type', '=', 'remove'), ('state', 'not in', ('cancel', 'refuse')) ]) From 0da086450d2146990281ea76c88cef6c7f2c4eca Mon Sep 17 00:00:00 2001 From: Bakry Date: Tue, 2 Dec 2025 12:34:28 +0300 Subject: [PATCH 2/3] fix --- odex25_hr/to_attendance_system/models/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/odex25_hr/to_attendance_system/models/models.py b/odex25_hr/to_attendance_system/models/models.py index 23b32dd04..419d88372 100644 --- a/odex25_hr/to_attendance_system/models/models.py +++ b/odex25_hr/to_attendance_system/models/models.py @@ -9,6 +9,7 @@ from .helper import httpHelper, is_valid_port, is_valid_ip, ParsedRequest class SystemAttendance(models.Model): _name = 'finger.system_attendance' + _order = 'punch_time DESC' punch_state = fields.Char("Punch state", readonly=True) area_alias = fields.Char("Area", readonly=True) @@ -581,4 +582,4 @@ class BiotimeAPI(models.Model): url = "{}?start_time={}&end_time={}&emp_code={}".format(transctionsUrl,yesterday,now, xm.code ) # url = "{}?punch_time={}&punch_time={}&emp_code={}".format(transctionsUrl, yesterday, now, xm.code) # print('################################# New Employee',url) - r.sync_employee_attenence(url) \ No newline at end of file + r.sync_employee_attenence(url) From 9eefc082cd031d70a68735c224c68258228227ee Mon Sep 17 00:00:00 2001 From: Bakry Date: Sun, 21 Dec 2025 17:01:48 +0300 Subject: [PATCH 3/3] fix holiday --- odex25_hr/hr_holidays_public/models/hr_holidays.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/odex25_hr/hr_holidays_public/models/hr_holidays.py b/odex25_hr/hr_holidays_public/models/hr_holidays.py index 2dd06cf27..a635cb4ec 100644 --- a/odex25_hr/hr_holidays_public/models/hr_holidays.py +++ b/odex25_hr/hr_holidays_public/models/hr_holidays.py @@ -1622,20 +1622,21 @@ class HRHolidays(models.Model): """chick a holiday take balance with years balance""" for item in self: holiday_days = item.number_of_days_temp + holiday_type = item.holiday_status_id.leave_type employee_balance = self.env['hr.holidays'].search([('employee_id', '=', item.employee_id.id), ('holiday_status_id', '=', item.holiday_status_id.id), ('type', '=', 'add'), ('check_allocation_view', '=', 'balance')], order='id desc', limit=1) leave_type = ['exam', 'marriage','parental','emergency','sick'] - if item.holiday_status_id.leave_type in leave_type: + if holiday_type in leave_type: cron_run_date = item.employee_id.first_hiring_date holi_date_from = fields.Date.from_string(item.date_from) holi_date_to = fields.Date.from_string(item.date_to) if employee_balance.holiday_ids: cron_run_date = employee_balance.holiday_ids[-1].cron_run_date - if cron_run_date > holi_date_to: + if (holiday_type=='sick' and cron_run_date > holi_date_to) or (cron_run_date.year > holi_date_to.year): holiday_days = 0 if holi_date_to >= cron_run_date > holi_date_from: holiday_days = (holi_date_to - cron_run_date).days+1