Skip to content
Snippets Groups Projects
Commit 4344d399 authored by Florian Vranckx's avatar Florian Vranckx
Browse files

[IMP] base: improve perfomance of has_group


Using the already existing indexing on the model to slightly improve the perfomance.

closes odoo/odoo#105280

Signed-off-by: default avatarVranckx Florian (flvr) <flvr@odoo.com>
parent 1b2c045f
Branches
Tags
No related merge requests found
......@@ -753,7 +753,7 @@ class Users(models.Model):
assert group_ext_id and '.' in group_ext_id, "External ID '%s' must be fully qualified" % group_ext_id
module, ext_id = group_ext_id.split('.')
self._cr.execute("""SELECT 1 FROM res_groups_users_rel WHERE uid=%s AND gid IN
(SELECT res_id FROM ir_model_data WHERE module=%s AND name=%s)""",
(SELECT res_id FROM ir_model_data WHERE module=%s AND name=%s AND model='res.groups')""",
(self._uid, module, ext_id))
return bool(self._cr.fetchone())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment