[FIX] web_editor: properly start website edit mode as restricted editor

It was impossible to open the website's edit mode as a user with
"restricted editor" permissions. The reason was that wysiwyg_multizone
was trying to manipulate data that is not injected into the html node
when `editable` is false (see `website.layout` template).

closes odoo/odoo#31702

Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
This commit is contained in:
Antoine Guenet
2019-03-18 09:32:14 +00:00
parent 7e96d485c7
commit becfef8f7b
4 changed files with 31 additions and 1 deletions
@@ -331,7 +331,7 @@ var WysiwygMultizone = Wysiwyg.extend({
var data = this._super();
var res_id = $editable.data('oe-id');
var res_model = $editable.data('oe-model');
if (!$editable.data('oe-model')) {
if (!$editable.data('oe-model') && $('html').data('editable')) {
var object = $('html').data('main-object');
res_model = object.split('(')[0];
res_id = +object.split('(')[1].split(',')[0];
@@ -0,0 +1,17 @@
odoo.define("website.tour.restricted_editor", function (require) {
"use strict";
var tour = require("web_tour.tour");
tour.register("restricted_editor", {
test: true,
url: "/",
}, [{
trigger: 'a[data-action=edit]',
content: "Click \"EDIT\" button of website as Restricted Editor",
extra_trigger: ".homepage",
}, {
trigger: '#oe_snippets.o_loaded',
content: "Check that the snippets loaded properly",
}]);
});