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 @@
-
+