diff --git a/addons/web_editor/views/iframe.xml b/addons/web_editor/views/iframe.xml
index 282d408a2dc..4c29a1b12f0 100644
--- a/addons/web_editor/views/iframe.xml
+++ b/addons/web_editor/views/iframe.xml
@@ -14,6 +14,13 @@
diff --git a/addons/web_tour/static/src/js/tour_service.js b/addons/web_tour/static/src/js/tour_service.js
index 261b4c13fe9..85c3a7b8811 100644
--- a/addons/web_tour/static/src/js/tour_service.js
+++ b/addons/web_tour/static/src/js/tour_service.js
@@ -27,7 +27,6 @@ return session.is_bound.then(function () {
// in the page source.
if (session.is_frontend && session.is_superuser) {
defs.push(new Model('web_tour.tour').call('get_consumed_tours'));
- defs.push(ajax.loadXML('/web_tour/static/src/xml/tip.xml', QWeb));
}
return $.when.apply($, defs).then(function (consumed_tours) {
var tour = new TourManager(session.is_frontend ? consumed_tours : session.web_tours);
@@ -51,24 +50,37 @@ return session.is_bound.then(function () {
}
}, 500);
var observer = new MutationObserver(check_tooltip);
- var start_service = function (observe) {
- $(function () {
- /**
- * Once the DOM is ready, we still have to wait all the modules are loaded before completing the tours
- * registration and starting listening for DOM mutations.
- */
- _.defer(function () {
- tour._register_all(observe);
- if (observe) {
- observer.observe(document.body, {
- attributes: true,
- childList: true,
- subtree: true,
+ var start_service = (function () {
+ var load_def;
+
+ return function (observe) {
+ if (load_def === undefined && observe && session.is_frontend) {
+ load_def = ajax.loadXML('/web_tour/static/src/xml/tip.xml', QWeb);
+ }
+
+ var def = $.Deferred();
+ $(function () {
+ /**
+ * Once the DOM is ready, we still have to wait all the modules are loaded before completing the tours
+ * registration and starting listening for DOM mutations.
+ */
+ $.when(load_def).then(function () {
+ _.defer(function () {
+ tour._register_all(observe);
+ if (observe) {
+ observer.observe(document.body, {
+ attributes: true,
+ childList: true,
+ subtree: true,
+ });
+ }
+ def.resolve();
});
- }
+ });
});
- });
- };
+ return def;
+ };
+ })();
// Enable the MutationObserver for the admin or if a tour is running, when the DOM is ready
start_service(session.is_superuser || tour.running_tour);
@@ -77,8 +89,15 @@ return session.is_bound.then(function () {
if (!session.is_superuser) {
var run = tour.run;
tour.run = function () {
- run.apply(this, arguments);
- if (this.running_tour) { start_service(true); }
+ var self = this;
+ var args = arguments;
+
+ start_service(true).then(function () {
+ run.apply(self, args);
+ if (!self.running_tour) {
+ observer.disconnect();
+ }
+ });
};
var _consume_tour = tour._consume_tour;
tour._consume_tour = function () {