From 7ea1cd88137efb13a0c370f2505568a22fc9e788 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: Thu, 27 Nov 2025 14:50:18 +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_hr_attendance/models/yuthon_shift_planning.py | 9 ++++++--- .../views/yuthon_shift_planning_views.xml | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/yuthon_hr_attendance/models/yuthon_shift_planning.py b/yuthon_hr_attendance/models/yuthon_shift_planning.py index 624720388..367f6809d 100644 --- a/yuthon_hr_attendance/models/yuthon_shift_planning.py +++ b/yuthon_hr_attendance/models/yuthon_shift_planning.py @@ -26,11 +26,14 @@ class YuthonShiftPlanning(models.Model): @api.depends('start_date', 'end_date') def _compute_is_effect(self): + today = fields.Date.today() for record in self: - if record.start_date and record.end_date: - record.is_effect = record.start_date <= fields.Date.today() <= record.end_date - else: + if not record.start_date: record.is_effect = False + elif not record.end_date: + record.is_effect = record.start_date <= today + else: + record.is_effect = record.start_date <= today <= record.end_date def confirm(self,next_date=False): selected_month = int(self.select_time) diff --git a/yuthon_hr_attendance/views/yuthon_shift_planning_views.xml b/yuthon_hr_attendance/views/yuthon_shift_planning_views.xml index 4c25b6acd..909b615e4 100644 --- a/yuthon_hr_attendance/views/yuthon_shift_planning_views.xml +++ b/yuthon_hr_attendance/views/yuthon_shift_planning_views.xml @@ -27,7 +27,7 @@ - +