From ca0faecbeb71f1286bf3cf0c5a6af752af9e54b0 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: Mon, 6 Jul 2026 15:46:07 +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 --- .../models/yuthon_onboard_approval.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py b/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py index 3b7b800e3..052bf9781 100644 --- a/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py +++ b/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py @@ -218,6 +218,13 @@ class YuthonOnboardApproval(models.Model): employee_id.write({'is_membership': True}) # employee_id.send_wecom_employee() employee_id.create_user() + # 根据公司名匹配 res.groups 中 department_ids 包含该公司名的组,把新用户加进去 + if employee_id.user_id and self.company_id and self.company_id.name: + matched_groups = self.env['res.groups'].sudo().search([ + ('department_ids.name', 'ilike', self.company_id.name) + ]) + if matched_groups: + matched_groups.sudo().write({'users': [(4, employee_id.user_id.id)]}) iots = self.env['attendance.iot'].sudo().search([('company_id', '=', self.company_id.id)]) for iot in iots: iot.action_init_device()