From b7eee16a585667e50aac0a50d0abb2c35660df82 Mon Sep 17 00:00:00 2001 From: Jigar Patel Date: Thu, 26 Oct 2017 17:19:51 +0530 Subject: [PATCH] [IMP] web_tour: Disable tours when Odoo installed with demo data --- addons/web_tour/__manifest__.py | 3 +++ addons/web_tour/data/web_tour_demo.xml | 11 ++++++++++ addons/web_tour/static/src/js/tour_disable.js | 21 +++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 addons/web_tour/data/web_tour_demo.xml create mode 100644 addons/web_tour/static/src/js/tour_disable.js diff --git a/addons/web_tour/__manifest__.py b/addons/web_tour/__manifest__.py index f7b7da2b959..6e89cf26673 100644 --- a/addons/web_tour/__manifest__.py +++ b/addons/web_tour/__manifest__.py @@ -16,6 +16,9 @@ Odoo Web tours. 'views/tour_templates.xml', 'views/tour_views.xml' ], + 'demo': [ + 'data/web_tour_demo.xml', + ], 'qweb': [ "static/src/xml/*.xml", ], diff --git a/addons/web_tour/data/web_tour_demo.xml b/addons/web_tour/data/web_tour_demo.xml new file mode 100644 index 00000000000..d3a4e5349ae --- /dev/null +++ b/addons/web_tour/data/web_tour_demo.xml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/addons/web_tour/static/src/js/tour_disable.js b/addons/web_tour/static/src/js/tour_disable.js new file mode 100644 index 00000000000..c90b5ba1127 --- /dev/null +++ b/addons/web_tour/static/src/js/tour_disable.js @@ -0,0 +1,21 @@ +odoo.define('web_tour.DisableTour', function (require) { +"use strict"; + +var TourManager = require('web_tour.TourManager'); + +TourManager.include({ + /** + * Disables tours if Odoo installed with demo data. + * + * @override + */ + _register: function (do_update, tour, name) { + // Consuming tours which are not run by test case + if (!this.running_tour) { + this.consumed_tours.push(name); + } + return this._super.apply(this, arguments); + }, +}); + +});