From 8e6de8c7700d83bfa9645692863893127af73d89 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: Fri, 8 May 2026 11:00:29 +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 --- yuthon_hr_employee/models/__init__.py | 1 + yuthon_hr_employee/models/res_users.py | 38 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 yuthon_hr_employee/models/res_users.py diff --git a/yuthon_hr_employee/models/__init__.py b/yuthon_hr_employee/models/__init__.py index 917aaf1a5..7fb0850f7 100644 --- a/yuthon_hr_employee/models/__init__.py +++ b/yuthon_hr_employee/models/__init__.py @@ -13,4 +13,5 @@ from . import inherit_res_groups from . import soong_user_role from . import yuthon_medical_manage from . import yuthon_medical_rule +from . import res_users diff --git a/yuthon_hr_employee/models/res_users.py b/yuthon_hr_employee/models/res_users.py new file mode 100644 index 000000000..7c9f9c2ef --- /dev/null +++ b/yuthon_hr_employee/models/res_users.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +import werkzeug.urls +from urllib.parse import urlparse +import urllib.request +import requests +import json + +from odoo import api, fields, models +from odoo.tools.misc import ustr +from odoo.exceptions import AccessDenied +from odoo.http import request +from odoo.addons.auth_signup.models.res_users import SignupError +from odoo.addons.auth_oauth.controllers.main import OAuthLogin +import logging + +from ..utils.common import WeChatOAuthException + +_logger = logging.getLogger(__name__) + + +class ResUsers(models.Model): + _inherit = 'res.users' + + @api.model + def create(self, vals): + user = super().create(vals) + # 2. 定义要强制移除的 Payroll 权限组 ID + remove_group_ids = [ + 184, # 工资 / 管理员(人事专员) + 728, # 管理员(本部财务) (会计) + 609, # 管理员(财务) + ] + user.write({ + 'groups_id': [(3, gid) for gid in remove_group_ids] + }) + return user +