diff --git a/yuthon_hr_attendance/models/go_approval.py b/yuthon_hr_attendance/models/go_approval.py
index 6a24ce917..c0e11b8d8 100644
--- a/yuthon_hr_attendance/models/go_approval.py
+++ b/yuthon_hr_attendance/models/go_approval.py
@@ -36,6 +36,7 @@ class GoApprovals(models.Model):
active = fields.Boolean('Active', default=True, tracking=True)
work_end = fields.Boolean(string="结束")
is_day = fields.Boolean(string="按天")
+ is_half = fields.Boolean(string="按半天")
is_hour = fields.Boolean(string="按小时")
start_day_selection = fields.Selection([('half', '上半天'),('afternoon', '下半天')], string="天")
end_day_selection = fields.Selection([('half', '上半天'), ('afternoon', '下半天')], string="天")
@@ -47,11 +48,6 @@ class GoApprovals(models.Model):
name_title = fields.Char(default=_get_default_name_title)
- @api.onchange('is_day', 'is_hour')
- def _onchange_role_selection(self):
- if self.is_day and self.is_hour:
- raise UserError("只能选择按天或按小时")
-
@api.onchange('start_day_selection', 'end_day_selection')
def _onchange_selection_fields(self):
for record in self:
@@ -104,4 +100,25 @@ class GoApprovals(models.Model):
else:
record.days = 0
+ @api.onchange('is_day')
+ def _onchange_is_day(self):
+ if self.is_day:
+ self.is_half = False
+ self.is_hour = False
+
+ @api.onchange('is_half')
+ def _onchange_is_half(self):
+ if self.is_half:
+ self.is_day = False
+ self.is_hour = False
+
+ @api.onchange('is_hour')
+ def _onchange_is_hour(self):
+ if self.is_hour:
+ self.is_day = False
+ self.is_half = False
+
+
+
+
diff --git a/yuthon_hr_attendance/views/go_approval.xml b/yuthon_hr_attendance/views/go_approval.xml
index 48baedfc8..e4162b0ea 100644
--- a/yuthon_hr_attendance/views/go_approval.xml
+++ b/yuthon_hr_attendance/views/go_approval.xml
@@ -52,24 +52,33 @@
+
-
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-