From 298f2f4aae75ec4917be2ff90e0560fbab0a640c Mon Sep 17 00:00:00 2001 From: Romeo Fragomeli Date: Fri, 7 Feb 2020 10:43:38 +0000 Subject: [PATCH] [IMP] web_tour: add 'mobile' flag for steps in tours We are not able to precise in which case a step should be executed. We already have 'edition' and now we introduce 'mobile'. undefined: Desktop + Mobile* true: Mobile* only false: Desktop only *: Responsive (<= SM), see isMobile --- addons/web_tour/static/src/js/tour_manager.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web_tour/static/src/js/tour_manager.js b/addons/web_tour/static/src/js/tour_manager.js index 969f2dd66a0..ba4f096d8ee 100644 --- a/addons/web_tour/static/src/js/tour_manager.js +++ b/addons/web_tour/static/src/js/tour_manager.js @@ -2,6 +2,7 @@ odoo.define('web_tour.TourManager', function(require) { "use strict"; var core = require('web.core'); +var config = require('web.config'); var local_storage = require('web.local_storage'); var mixins = require('web.mixins'); var utils = require('web_tour.utils'); @@ -116,7 +117,8 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, { return tour.wait_for.then((function () { tour.current_step = parseInt(local_storage.getItem(get_step_key(name))) || 0; tour.steps = _.filter(tour.steps, (function (step) { - return !step.edition || step.edition === this.edition; + return (!step.edition || step.edition === this.edition) && + (step.mobile === undefined || step.mobile === config.device.isMobile); }).bind(this)); if (tour_is_consumed || tour.current_step >= tour.steps.length) {