添加功能

This commit is contained in:
李鹏宇
2026-07-06 15:46:07 +08:00
parent 9e6ac6b1ae
commit ca0faecbeb
@@ -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()