From 9eefc082cd031d70a68735c224c68258228227ee Mon Sep 17 00:00:00 2001 From: Bakry Date: Sun, 21 Dec 2025 17:01:48 +0300 Subject: [PATCH] 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