diff --git a/soong_workflow/models/soong_user_role.py b/soong_workflow/models/soong_user_role.py index 6bae61132..056a12b9e 100644 --- a/soong_workflow/models/soong_user_role.py +++ b/soong_workflow/models/soong_user_role.py @@ -68,6 +68,12 @@ class YuthonUserRole(models.Model): if department_id: job.sudo().write({'department_id': department_id.id if len(department_id) == 1 else department_id[0].id}) + def f6_new(self): + role_ids = self.env["soong.user.role"].browse(self._context.get('active_ids', self._context.get('active_id'))) + for role in role_ids: + company_id = role.department_id.company_id + role.sudo().write({'company_id': company_id.id if company_id else False}) + def sync_new(self): job_ids = self.env["soong.user.role"].browse(self._context.get('active_ids', self._context.get('active_id'))) for job in job_ids: diff --git a/soong_workflow/views/soong_user_role_views.xml b/soong_workflow/views/soong_user_role_views.xml index 98653ef77..e019f21fd 100644 --- a/soong_workflow/views/soong_user_role_views.xml +++ b/soong_workflow/views/soong_user_role_views.xml @@ -7,6 +7,13 @@ code action = model.f5_new() + + 更新公司 + + + code + action = model.f6_new() + 同步花名册 diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index 364891e78..ee2e8f852 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -123,6 +123,27 @@ class HrAttendance(models.Model): } } + def button_source(self): + employee_id = self.employee_id.id + current_date = self.current_data + domain = [ + ('employee_id', '=', employee_id), + ('checkin_time', '>=', fields.Datetime.to_string(datetime.combine(current_date, datetime.min.time()))), + ('checkin_time', '<', fields.Datetime.to_string(datetime.combine(current_date, datetime.max.time()))) + ] + attendance_records = self.env['hr.attendance.detail'].search(domain) + if attendance_records: + action = { + 'name': '考勤记录列表', + 'type': 'ir.actions.act_window', + 'res_model': 'hr.attendance.detail', + 'view_mode': 'tree', + 'domain': domain, + } + return action + else: + raise ValidationError("该员工当天没有考勤记录!") + def button_card_approval(self): form_id = self.env.ref('yuthon_hr_attendance.card_approval_form').id if self.is_approval: diff --git a/yuthon_hr_attendance/views/hr_attendance_detail_wechat_views.xml b/yuthon_hr_attendance/views/hr_attendance_detail_wechat_views.xml index 8486de5a4..69c95d9b7 100644 --- a/yuthon_hr_attendance/views/hr_attendance_detail_wechat_views.xml +++ b/yuthon_hr_attendance/views/hr_attendance_detail_wechat_views.xml @@ -72,7 +72,7 @@ - + \ No newline at end of file diff --git a/yuthon_hr_attendance/views/hr_attendance_views.xml b/yuthon_hr_attendance/views/hr_attendance_views.xml index fae261570..91d737fc9 100644 --- a/yuthon_hr_attendance/views/hr_attendance_views.xml +++ b/yuthon_hr_attendance/views/hr_attendance_views.xml @@ -28,6 +28,7 @@