Skip to content

Commit

Permalink
[MIG] base_user_role_company: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BertVGroenendael committed Oct 23, 2024
1 parent 558b275 commit f127f54
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions base_user_role_company/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ Contributors

- Robin Conjour <[email protected]>

`Dynapps <http://dynapps.eu>`__

- Bert Van Groenendael <[email protected]>

Maintainers
-----------

Expand Down
8 changes: 4 additions & 4 deletions base_user_role_company/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions base_user_role_company/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@
[WeSolved](http://wesolved.com)

> - Robin Conjour \<<[email protected]>\>
[Dynapps](http://dynapps.eu)

> - Bert Van Groenendael \<<[email protected]>\>
6 changes: 6 additions & 0 deletions base_user_role_company/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,12 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Robin Conjour &lt;<a class="reference external" href="mailto:rconjour&#64;wesolved.com">rconjour&#64;wesolved.com</a>&gt;</li>
</ul>
</blockquote>
<p><a class="reference external" href="http://dynapps.eu">Dynapps</a></p>
<blockquote>
<ul class="simple">
<li>Bert Van Groenendael &lt;<a class="reference external" href="mailto:bert.vangroenendael&#64;dynapps.eu">bert.vangroenendael&#64;dynapps.eu</a>&gt;</li>
</ul>
</blockquote>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
Expand Down

0 comments on commit f127f54

Please sign in to comment.