diff --git a/base_user_role_company/README.rst b/base_user_role_company/README.rst index f59ad0ce1..184839e31 100644 --- a/base_user_role_company/README.rst +++ b/base_user_role_company/README.rst @@ -113,6 +113,10 @@ Contributors - Robin Conjour +`Dynapps `__ + + - Bert Van Groenendael + Maintainers ----------- diff --git a/base_user_role_company/models/role.py b/base_user_role_company/models/role.py index 06a8df328..3cadca8a0 100644 --- a/base_user_role_company/models/role.py +++ b/base_user_role_company/models/role.py @@ -1,7 +1,7 @@ # Copyright (C) 2021 Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.exceptions import ValidationError @@ -26,7 +26,7 @@ def _check_company(self): and record.company_id not in record.user_id.company_ids ): raise ValidationError( - _( + self.env._( 'User "%(user)s" does not have access to the company ' '"%(company)s"' ) diff --git a/base_user_role_company/models/user.py b/base_user_role_company/models/user.py index f050be474..38a84af6d 100644 --- a/base_user_role_company/models/user.py +++ b/base_user_role_company/models/user.py @@ -8,16 +8,16 @@ class ResUsers(models.Model): _inherit = "res.users" @classmethod - def authenticate(cls, db, login, password, user_agent_env): - uid = super().authenticate(db, login, password, user_agent_env) + def authenticate(cls, db, credential, user_agent_env): + auth_info = super().authenticate(db, credential, user_agent_env) # On login, ensure the proper roles are applied # The last Role applied may not be the correct one, # sonce the new session current company can be different with cls.pool.cursor() as cr: - env = api.Environment(cr, uid, {}) + env = api.Environment(cr, auth_info["uid"], {}) if env.user.role_line_ids: env.user.set_groups_from_roles() - return uid + return auth_info def _get_enabled_roles(self): res = super()._get_enabled_roles() diff --git a/base_user_role_company/readme/CONTRIBUTORS.md b/base_user_role_company/readme/CONTRIBUTORS.md index 8fa3c89a9..62de1987e 100644 --- a/base_user_role_company/readme/CONTRIBUTORS.md +++ b/base_user_role_company/readme/CONTRIBUTORS.md @@ -7,3 +7,7 @@ [WeSolved](http://wesolved.com) > - Robin Conjour \<\> + +[Dynapps](http://dynapps.eu) + +> - Bert Van Groenendael \<\> diff --git a/base_user_role_company/static/description/index.html b/base_user_role_company/static/description/index.html index f4b1b4fb6..836d5dc80 100644 --- a/base_user_role_company/static/description/index.html +++ b/base_user_role_company/static/description/index.html @@ -457,6 +457,12 @@

Contributors

  • Robin Conjour <rconjour@wesolved.com>
  • +

    Dynapps

    +
    + +

    Maintainers

    diff --git a/base_user_role_company/views/role.xml b/base_user_role_company/views/role.xml index 0a0a22e3f..866b3a18a 100644 --- a/base_user_role_company/views/role.xml +++ b/base_user_role_company/views/role.xml @@ -12,7 +12,7 @@ expr="//field[@name='role_line_ids']//field[@name='role_id']" position="after" > - +