From f6c27743d013ac0c81a7ab8a2091f9636a4f6e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Wed, 6 May 2026 20:23:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_base/__manifest__.py | 2 +- yuthon_base/data/res_users_data.xml | 8 ++++++-- yuthon_base/models/res_users.py | 17 ++++++++++------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/yuthon_base/__manifest__.py b/yuthon_base/__manifest__.py index 00b5706a4..04f507692 100644 --- a/yuthon_base/__manifest__.py +++ b/yuthon_base/__manifest__.py @@ -26,7 +26,7 @@ ] }, 'demo': [], - 'depends': ['hr', 'mail', 'base', 'survey', 'account'], + 'depends': ['hr', 'mail', 'base', 'survey', 'account', 'hr_payroll'], 'installable': True, 'application': True, } diff --git a/yuthon_base/data/res_users_data.xml b/yuthon_base/data/res_users_data.xml index 3f34e3b77..f421fe2b5 100644 --- a/yuthon_base/data/res_users_data.xml +++ b/yuthon_base/data/res_users_data.xml @@ -1,7 +1,11 @@ - + - + diff --git a/yuthon_base/models/res_users.py b/yuthon_base/models/res_users.py index 93f65c94c..04271274b 100644 --- a/yuthon_base/models/res_users.py +++ b/yuthon_base/models/res_users.py @@ -8,14 +8,17 @@ class ResUsers(models.Model): @api.model_create_multi def create(self, vals_list): users = super().create(vals_list) - # 新建用户后确保移除财务管理员权限组 + # 新建用户后确保移除财务和薪资管理员权限组 groups_to_remove = [] - group_manager = self.env.ref('account.group_account_manager', raise_if_not_found=False) - group_invoice = self.env.ref('account.group_account_invoice', raise_if_not_found=False) - if group_manager: - groups_to_remove.append((3, group_manager.id)) - if group_invoice: - groups_to_remove.append((3, group_invoice.id)) + group_refs = [ + 'account.group_account_manager', + 'account.group_account_invoice', + 'hr_payroll.group_hr_payroll_manager', + ] + for ref in group_refs: + group = self.env.ref(ref, raise_if_not_found=False) + if group: + groups_to_remove.append((3, group.id)) if groups_to_remove: users.sudo().write({'groups_id': groups_to_remove}) return users