[FIX] website: correctly activate tour for each website

- Creating a website through the configurator activated the configurator tour.
This tour was active for every websites even the ones not created using the
configurator. Theme tours were overridden by the configurator tour when they
should have been the active tour for website not created using the configurator.

Now the configurator tour is an asset specific to each website. This asset is
deactivated by default and activated for a website only if it is created using
the configurator.

- Some actions of the website tour were also visible when we were not in edit
mode. extra_trigger has been added on these actions to ensure they are visible
only in edit mode.

task-2518565

closes odoo/odoo#72827

X-original-commit: 5799410ec257fc7f756722579d3d0141b0ce7de4
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
Sébastien Mottet (oms)
2021-06-28 07:24:29 +00:00
parent 43b41ad948
commit 6ba709a812
4 changed files with 9 additions and 4 deletions
+2 -1
View File
@@ -25,7 +25,8 @@
</record>
<record id="website.configurator_tour" model="ir.asset">
<field name="name">website.configurator_tour</field>
<field name="key">website.configurator_tour</field>
<field name="name">Website Configurator Tour</field>
<field name="bundle">website.assets_editor</field>
<field name="path">website/static/src/js/tours/configurator_tour.js</field>
<field name="active" eval="False"/>
+2 -2
View File
@@ -418,8 +418,8 @@ class Website(models.Model):
website.configurator_done = True
# Enable tour
tour_asset_id = self.env['ir.asset']._get_related_assets([('name', '=', 'website.configurator_tour')])
tour_asset_id.sudo().write({'active': True})
tour_asset_id = self.env.ref('website.configurator_tour')
tour_asset_id.copy({'key': tour_asset_id.key, 'website_id': website.id, 'active': True})
# logo was generated as base64 url
logo = kwargs.get('logo')
@@ -1,4 +1,4 @@
odoo.define("website.configurator.tour", function (require) {
odoo.define("website.configurator_tour", function (require) {
"use strict";
const wTourUtils = require("website.tour_utils");
@@ -55,6 +55,7 @@ function changeColumnSize(position = "right") {
function changeIcon(snippet, index = 0, position = "bottom") {
return {
trigger: `#wrapwrap .${snippet.id} i:eq(${index})`,
extra_trigger: "body.editor_enable",
content: _t("<b>Double click on an icon</b> to change it with one of your choice."),
position: position,
run: "dblclick",
@@ -64,6 +65,7 @@ function changeIcon(snippet, index = 0, position = "bottom") {
function changeImage(snippet, position = "bottom") {
return {
trigger: snippet.id ? `#wrapwrap .${snippet.id} img` : snippet,
extra_trigger: "body.editor_enable",
content: _t("<b>Double click on an image</b> to change it with one of your choice."),
position: position,
run: "dblclick",
@@ -130,6 +132,7 @@ function clickOnEdit(position = "bottom") {
function clickOnSnippet(snippet, position = "bottom") {
return {
trigger: snippet.id ? `#wrapwrap .${snippet.id}` : snippet,
extra_trigger: "body.editor_enable",
content: _t("<b>Click on a snippet</b> to access its options menu."),
position: position,
run: "click",
@@ -158,6 +161,7 @@ function clickOnSave(position = "bottom") {
function clickOnText(snippet, element, position = "bottom") {
return {
trigger: snippet.id ? `#wrapwrap .${snippet.id} ${element}` : snippet,
extra_trigger: "body.editor_enable",
content: _t("<b>Click on a text</b> to start editing it."),
position: position,
run: "text",