[FIX] strip group name before calling has_group
user_has_groups is used to check for groups in e.g. view attributes (`@groups`). When trying to format lists of groups in views, it would break down as it would pass e.g. `\n some.group` to `res.users.has_group`, which would look for an xid with the module `\n some` and (oddly enough) not find it. Theoretically could also handle that inside res.users.has_group but it seems ever-so-slightly more risky, and has_group is only used programmatically and should thus already be called correctly. fixes #9797
This commit is contained in:
parent
0093372184
commit
7c0e734785
|
@ -1372,7 +1372,7 @@ class BaseModel(object):
|
||||||
:return: True if the current user is a member of one of the
|
:return: True if the current user is a member of one of the
|
||||||
given groups
|
given groups
|
||||||
"""
|
"""
|
||||||
return any(self.pool['res.users'].has_group(cr, uid, group_ext_id)
|
return any(self.pool['res.users'].has_group(cr, uid, group_ext_id.strip())
|
||||||
for group_ext_id in groups.split(','))
|
for group_ext_id in groups.split(','))
|
||||||
|
|
||||||
def _get_default_form_view(self, cr, user, context=None):
|
def _get_default_form_view(self, cr, user, context=None):
|
||||||
|
|
Loading…
Reference in New Issue