From d8dc4cbafca6268155bb5a0d4d9fd55d2a0d3cec Mon Sep 17 00:00:00 2001
From: jvm-odoo <jvm@odoo.com>
Date: Wed, 5 Feb 2020 09:25:01 +0000
Subject: [PATCH] [FIX] web_tour: fix too much tips on appswitcher

Issue

	- Deactivate demo data
	- Install several modules (e.g. Sales, Helpdesk)
	- Go on Home
	- Hard refresh

	All tours' tips are shown

Cause

	In 02dab5dc881, we wait the DOM to be ready.
	The DOM wasn't ready in previous version, this is
	why it seems to work.

	As the DOM is ready, in check_for_tooltip we
	have a visible trigger so trigerred = true
	and the tip is activated.

	If you activate the debug mode, the DOM is
	not ready too, this is why it works fine
	in debug mode.

Solution

	I don't think that not waiting the DOM to be
	ready is good so I think we should keep that
	and handle the case when we update the tours
	from the _register method. So that, we use
	the else part of the update method which
	will break after a tip has been activated.

OPW-2188525

closes odoo/odoo#45073

X-original-commit: 5f0451c54cb785cc940b78a489316bed5ad9d888
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
---
 addons/web_tour/static/src/js/tour_manager.js | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/addons/web_tour/static/src/js/tour_manager.js b/addons/web_tour/static/src/js/tour_manager.js
index 6e3ebff46e7f..969f2dd66a08 100644
--- a/addons/web_tour/static/src/js/tour_manager.js
+++ b/addons/web_tour/static/src/js/tour_manager.js
@@ -105,7 +105,7 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, {
         return self._waitBeforeTourStart().then(function () {
             return Promise.all(_.map(self.tours, function (tour, name) {
                 return self._register(do_update, tour, name);
-            }));
+            })).then(() => self.update());
         });
     },
     _register: function (do_update, tour, name) {
@@ -128,7 +128,6 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, {
 
             if (do_update && (this.running_tour === name || (!this.running_tour && !tour.test && !tour_is_consumed))) {
                 this._to_next_step(name, 0);
-                this.update(name);
             }
         }).bind(this));
     },
-- 
GitLab