From a99d8e05ab9e4206da2dd073d7d09b0677131ed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Mon, 16 Mar 2026 20:09:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_catering/models/yuthon_catering.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/yuthon_catering/models/yuthon_catering.py b/yuthon_catering/models/yuthon_catering.py index baff94f9b..91abe6b5b 100644 --- a/yuthon_catering/models/yuthon_catering.py +++ b/yuthon_catering/models/yuthon_catering.py @@ -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):