fix send_lateness_notifications

This commit is contained in:
Mazen Abdo 2024-11-19 08:22:43 +02:00
parent 8cfba52ef6
commit d2d13fa08c
1 changed files with 5 additions and 5 deletions

View File

@ -1123,15 +1123,15 @@ class HrAttendanceTransactions(models.Model):
template_id = self.env.ref('attendances.attendance_notification_email_template').id
for record in records_to_notify:
if (
record.lateness > 0 and
record.early_exit > 0 and
record.is_absent and
(record.sign_out == 0 or record.sign_in == 0)
record.lateness > 0 or
record.early_exit > 0 or
record.is_absent or
(record.sign_out == 0 and record.sign_in != 0) or
(record.sign_out != 0 and record.sign_in == 0)
):
if template_id:
template = self.env['mail.template'].browse(template_id)
template.send_mail(record.id, force_send=True)
# @api.multi
# def unlink(self):
# raise UserError(_('Sorry, you can not delete an attendance transaction manually.'))