Problem sending check-in/check-out reminder notifications on official holidays.

This commit is contained in:
younes 2025-07-20 13:25:49 +01:00
parent 42e95115e3
commit 4d4fcf6f21
1 changed files with 5 additions and 1 deletions

View File

@ -100,6 +100,10 @@ class HrEmployee(models.Model):
holiday_ids = holiday_obj.search([('employee_id', '=', emp.id),('type', '!=', 'add'),
('date_from', '<=', str(date_now)),('date_to', '>=', str(date_now)),
('state', 'not in', ['draft', 'cancel', 'Refuse'])])
hr_holiday_officials = self.env['hr.holiday.officials'].search(
[('active', '=', True), ('state', '=', 'confirm'),
('date_from', '<=', str(date_now)),
('date_to', '>=',str(date_now))])
attendance_in_ids = attendance_obj.search([('employee_id', '=', emp.id),('action', 'in', ['sign_in']),
('name', '>=', str(min_sign_in)), ('name', '<=', str(max_sign_in))])
@ -107,7 +111,7 @@ class HrEmployee(models.Model):
attendance_out_ids = attendance_obj.search([('employee_id', '=', emp.id),('action', 'in', ['sign_out']),
('name', '>=', str(min_sign_out)), ('name', '<=', str(max_sign_out))])
if not holiday_ids:
if not holiday_ids and not hr_holiday_officials:
if date_now >= min_sign_in and date_now <= max_sign_in and not attendance_in_ids:
employee_list.append(emp.id)
msg = _('Dear employee, Please Sign-in')