diff --git a/soong_workflow/views/soong_workflow_record.xml b/soong_workflow/views/soong_workflow_record.xml index 0fab0d917..f66a7735f 100644 --- a/soong_workflow/views/soong_workflow_record.xml +++ b/soong_workflow/views/soong_workflow_record.xml @@ -15,6 +15,7 @@ + @@ -118,8 +119,9 @@ ir.actions.act_window soong.workflow.record tree,kanban,search - [('employee_ids.user_id', '=', uid), ('reclaim_state', '=', False)] + [('reclaim_state', '=', False)] + {'search_default_group_by_employee': True} 人事相关流程 diff --git a/yuthon_hr_attendance/models/go_approval.py b/yuthon_hr_attendance/models/go_approval.py index 1b69c32f8..0d5553625 100644 --- a/yuthon_hr_attendance/models/go_approval.py +++ b/yuthon_hr_attendance/models/go_approval.py @@ -47,20 +47,22 @@ 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: + return { + 'warning': { + 'title': _('输入错误'), + 'message': _('只能选择主角色或者角色组中的一个,不能同时选择。') + } + } + @api.onchange('start_day_selection', 'end_day_selection') def _onchange_selection_fields(self): for record in self: - if record.start_day_selection == 'afternoon' and record.end_day_selection == 'half': - raise ValidationError("当开始日期为下半天时,结束选择日期只能下半天。") - if record.start_day_selection == 'afternoon' and record.end_day_selection == 'afternoon': - record.hours = 4 - record.days = 0.5 - elif record.start_day_selection == 'half' and record.end_day_selection == 'afternoon': - record.hours = 8 - record.days = 1 - else: - record.hours = 0 - record.days = 0 + if record.statr_date == record.end_date: + if record.start_day_selection == 'afternoon' and record.end_day_selection == 'half': + raise ValidationError("当开始日期为下半天时,结束选择日期只能下半天。") @api.onchange('date_start', 'date_end') def _onchange_date_range(self): @@ -98,4 +100,13 @@ class GoApprovals(models.Model): else: rec.name = f"{rec.users_id.name}外出" + @api.onchange('statr_date', 'end_date') + def _onchange_days(self): + for record in self: + if record.statr_date and record.end_date: + delta = record.end_date - record.statr_date + record.days = delta.days if delta.days >= 0 else 0 # 防止负数 + else: + record.days = 0 + diff --git a/yuthon_hr_attendance/views/card_approval.xml b/yuthon_hr_attendance/views/card_approval.xml index 985ae9a07..1ed4e0f78 100644 --- a/yuthon_hr_attendance/views/card_approval.xml +++ b/yuthon_hr_attendance/views/card_approval.xml @@ -41,20 +41,23 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/yuthon_hr_attendance/views/go_approval.xml b/yuthon_hr_attendance/views/go_approval.xml index 43d3f920c..48baedfc8 100644 --- a/yuthon_hr_attendance/views/go_approval.xml +++ b/yuthon_hr_attendance/views/go_approval.xml @@ -63,8 +63,8 @@ - - + + @@ -72,12 +72,17 @@ + + + + + diff --git a/yuthon_hr_attendance/views/overtime_approval.xml b/yuthon_hr_attendance/views/overtime_approval.xml index 4df8b6f8b..77dab9796 100644 --- a/yuthon_hr_attendance/views/overtime_approval.xml +++ b/yuthon_hr_attendance/views/overtime_approval.xml @@ -64,8 +64,8 @@ - - + +