Problem sending check-in/check-out reminder notifications on official holidays.
This commit is contained in:
parent
42e95115e3
commit
4d4fcf6f21
|
|
@ -100,6 +100,10 @@ class HrEmployee(models.Model):
|
||||||
holiday_ids = holiday_obj.search([('employee_id', '=', emp.id),('type', '!=', 'add'),
|
holiday_ids = holiday_obj.search([('employee_id', '=', emp.id),('type', '!=', 'add'),
|
||||||
('date_from', '<=', str(date_now)),('date_to', '>=', str(date_now)),
|
('date_from', '<=', str(date_now)),('date_to', '>=', str(date_now)),
|
||||||
('state', 'not in', ['draft', 'cancel', 'Refuse'])])
|
('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']),
|
attendance_in_ids = attendance_obj.search([('employee_id', '=', emp.id),('action', 'in', ['sign_in']),
|
||||||
('name', '>=', str(min_sign_in)), ('name', '<=', str(max_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']),
|
attendance_out_ids = attendance_obj.search([('employee_id', '=', emp.id),('action', 'in', ['sign_out']),
|
||||||
('name', '>=', str(min_sign_out)), ('name', '<=', str(max_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:
|
if date_now >= min_sign_in and date_now <= max_sign_in and not attendance_in_ids:
|
||||||
employee_list.append(emp.id)
|
employee_list.append(emp.id)
|
||||||
msg = _('Dear employee, Please Sign-in')
|
msg = _('Dear employee, Please Sign-in')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue