From 7c0e7347855a9bbc5014f55b8bb1225dff930a1a Mon Sep 17 00:00:00 2001 From: xmo-odoo Date: Mon, 21 Dec 2015 10:30:37 +0100 Subject: [PATCH] [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 --- openerp/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/models.py b/openerp/models.py index 076368a6095..7da181495a8 100644 --- a/openerp/models.py +++ b/openerp/models.py @@ -1372,7 +1372,7 @@ class BaseModel(object): :return: True if the current user is a member of one of the 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(',')) def _get_default_form_view(self, cr, user, context=None):