From 5ffb3068cd754cce641d21fb9606e59f3117f467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Tue, 11 Aug 2026 10:37:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=B7=E5=81=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_holiday/models/inherit_hr_leave.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py index 42635c8a4..5b10db45a 100644 --- a/yuthon_holiday/models/inherit_hr_leave.py +++ b/yuthon_holiday/models/inherit_hr_leave.py @@ -959,13 +959,13 @@ class HolidaysRequestBatch(models.Model): if not start_date or not end_date: return 0 slots = self.env['planning.slot'].sudo().search([ - ('resource_id', '=', employee_id.resource_id.id), - ('start_datetime', '>=', datetime.combine(start_date, datetime.min.time())), - ('end_datetime', '<=', datetime.combine(end_date, datetime.max.time())), + ('resource_id.name', 'like', employee_id.resource_id.name), + ('start_datetime', '>=', datetime.combine(start_date, datetime.min.time()) - timedelta(hours=8)), + ('end_datetime', '<=', datetime.combine(end_date, datetime.max.time())- timedelta(hours=8)), ]) work_days = set() for slot in slots: - day = slot.start_datetime.date() + day = (slot.start_datetime + timedelta(hours=8)).date() if start_date <= day <= end_date: work_days.add(day) return len(work_days)