[FIX] website: 'Display Editor Bar on Website' group stopped working at commit a2ef044c47

The Edit button never appeared anymore for these users.
The idea was that they should see an edit button with
limited editing capabilities depending on their other
access rights.
For example, someone with only Sales Manager access and
'Display Editor Bar on Website'
would be able to edit online quotes from the website_quote
module, but not change the actual website pages or menus,
for instance.
This commit is contained in:
Christophe Matthieu 2014-09-25 15:32:25 +02:00 committed by Olivier Dony
parent dd2f229153
commit 77c41cc5cb
5 changed files with 15 additions and 15 deletions

View File

@ -159,7 +159,10 @@ class view(osv.osv):
qcontext.update(values)
# in edit mode ir.ui.view will tag nodes
context = dict(context, inherit_branding=qcontext.get('editable', False))
if qcontext.get('editable'):
context = dict(context, inherit_branding=True)
elif request.registry['res.users'].has_group(cr, uid, 'base.group_website_publisher'):
context = dict(context, inherit_branding_auto=True)
view_obj = request.website.get_template(id_or_xml_id)
if 'main_object' not in qcontext:

View File

@ -308,7 +308,6 @@
this.$('#website-top-edit').hide();
this.$('#website-top-view').show();
this.$buttons.edit.show();
var $edit_button = this.$buttons.edit
.prop('disabled', website.no_editor);
@ -822,14 +821,7 @@
return $(root).find('[data-oe-model]')
.not('[data-oe-type = "selection"]')
.not('link, script')
.not('.oe_snippet_editor')
.filter(function () {
var $this = $(this);
// keep view sections and fields which are *not* in
// view sections for top-level editables
return $this.data('oe-model') === 'ir.ui.view'
|| !$this.closest('[data-oe-model = "ir.ui.view"]').length;
});
.not('.oe_snippet_editor');
},
_current_editor: function () {

View File

@ -282,8 +282,9 @@
return templates_def;
}).then(function () {
// display button if they are at least one editable zone in the page (check the branding)
var editable = $('html').data('website-id') && !!$('[data-oe-model]').size();
$("#oe_editzone").toggle(editable);
if (!!$('[data-oe-model]').size()) {
$("#oe_editzone").show();
}
if ($('html').data('website-id')) {
website.id = $('html').data('website-id');

View File

@ -25,8 +25,8 @@
</li>
</ul>
<ul id="oe_editzone" class="nav navbar-nav hidden-xs" style="padding-left: 20px;" groups="base.group_website_publisher">
<li><button type="button" data-action="edit" class="btn btn-primary btn-xs" style="display: none;">Edit</button></li>
<ul id="oe_editzone" class="nav navbar-nav hidden-xs" style="padding-left: 20px; display: none;" groups="base.group_website_publisher">
<li><button type="button" data-action="edit" class="btn btn-primary btn-xs">Edit</button></li>
</ul>
<ul id="oe_systray" class="nav navbar-nav navbar-right pull-right hidden-xs">

View File

@ -555,7 +555,11 @@ class FieldConverter(osv.AbstractModel):
field_name, record._name, exc_info=True)
content = None
if context and context.get('inherit_branding'):
inherit_branding = context and context.get('inherit_branding')
if not inherit_branding and context and context.get('inherit_branding_auto'):
inherit_branding = self.pool['ir.model.access'].check(cr, uid, record._name, 'write', False, context=context)
if inherit_branding:
# add branding attributes
g_att += ''.join(
' %s="%s"' % (name, escape(value))