From a1e1e27ec8a4bf955eaae9169c915a8394e5c8a5 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Tue, 2 Aug 2016 17:46:25 +0200 Subject: [PATCH] [FIX] base: deletion of elements with attribute 'groups' The test made to perform the deletion was not correctly migrated (see https://github.com/odoo/odoo/commit/4ddc32313996c8cf6e8e6dffd2253aad8a144ccf#diff-3ad2ad1e9b88257a01a42d04ca1c0605L274): the user to test must be the request user and not the qwebcontext user. Thanks to @rco-odoo. --- openerp/addons/base/ir/ir_qweb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/ir/ir_qweb.py b/openerp/addons/base/ir/ir_qweb.py index 3a572878d28..bc71fdcf3b8 100644 --- a/openerp/addons/base/ir/ir_qweb.py +++ b/openerp/addons/base/ir/ir_qweb.py @@ -259,8 +259,8 @@ class QWeb(models.AbstractModel): for (attribute_name, attribute_value) in element.attrib.iteritems(): attribute_name = unicode(attribute_name) if attribute_name == "groups": - can_see = (qwebcontext.cr and qwebcontext.uid and - qwebcontext.env['ir.qweb'].user_has_groups(attribute_value)) + env = qwebcontext.get('request') and qwebcontext['request'].env + can_see = (env and env.cr and env.uid and env['ir.qweb'].user_has_groups(attribute_value)) if not can_see: return element.tail and self.render_tail(element.tail, element, qwebcontext) or ''