diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index f8d1a66bc80..601d3016068 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -497,11 +497,11 @@ this.$('#website-top-edit').hide(); this.$('#website-top-view').show(); + var $edit_button = this.$('button[data-action=edit]') + .prop('disabled', website.no_editor); if (website.no_editor) { var help_text = $(document.documentElement).data('editable-no-editor'); - this.$('button[data-action=edit]') - .prop('disabled', website.no_editor) - .parent() + $edit_button.parent() // help must be set on form above button because it does // not appear on disabled button .attr('title', help_text); diff --git a/openerp/addons/base/ir/ir_qweb.py b/openerp/addons/base/ir/ir_qweb.py index 5fb56a2b4a3..1209e457958 100644 --- a/openerp/addons/base/ir/ir_qweb.py +++ b/openerp/addons/base/ir/ir_qweb.py @@ -256,15 +256,14 @@ class QWeb(orm.AbstractModel): cr = qwebcontext.get('request') and qwebcontext['request'].cr or None uid = qwebcontext.get('request') and qwebcontext['request'].uid or None can_see = self.user_has_groups(cr, uid, groups=attribute_value) if cr and uid else False - if can_see: - continue - if qwebcontext.get('editable') and not qwebcontext.get('editable_no_editor'): - errmsg = _("Editor disabled because some content can not be seen by a user who does not belong to the groups %s") - raise openerp.http.Retry( - _("User does not belong to groups %s") % attribute_value, { - 'editable_no_editor': errmsg % attribute_value - }) - return '' + if not can_see: + if qwebcontext.get('editable') and not qwebcontext.get('editable_no_editor'): + errmsg = _("Editor disabled because some content can not be seen by a user who does not belong to the groups %s") + raise openerp.http.Retry( + _("User does not belong to groups %s") % attribute_value, { + 'editable_no_editor': errmsg % attribute_value + }) + return '' if isinstance(attribute_value, unicode): attribute_value = attribute_value.encode("utf8")