添加功能

This commit is contained in:
李鹏宇
2026-03-16 20:09:15 +08:00
parent 0177d64d71
commit a99d8e05ab
+11 -1
View File
@@ -211,7 +211,7 @@ class YuthonCatering(models.Model):
])
if unconfirmed_records:
for record in unconfirmed_records:
if self.is_expatriates(today, record.employee_id):
if self.is_expatriates(today, record.employee_id) or self.is_leave(today, record.employee_id):
breakfast = False
lunch = False
else:
@@ -243,6 +243,16 @@ class YuthonCatering(models.Model):
if current_data >= back_approval.end_date:
return False
def is_leave(self, current_data, employee):
att_id = self.env['hr.attendance'].search([
('employee_id', '=', employee.id),
('current_data', '=', current_data)
], limit=1)
if att_id and att_id.workflow_id and att_id.workflow_id.name == '请假':
record_id = self.env[att_id.workflow_id.res_model].search([('id', '=', att_id.workflow_id.res_id)])
if record_id:
if record_id.days >= 1:
return True
# 定义定时任务方法,每天九点半发送消息提醒
def cron_send_message(self):