diff options
| author | Aaron Bohy <aab@odoo.com> | 2016-07-20 09:44:59 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2016-07-20 17:59:48 +0200 |
| commit | 0a8ec457693351fa32183ffc20bbf6590e71144a (patch) | |
| tree | 1f977b4e32debed340c2b7b3730ea810379a13c9 /addons/web_tour/static/src/js/debug_manager.js | |
| parent | d1cd293ecefde56bf649aa69b5da808755f6a4b8 (diff) | |
[IMP] web_tour: add button to consume all tours in debug_manager
Changes the api of the consume method on the web_tour.tour model so that it
now takes in argument an array of tour names instead of a single tour name.
Diffstat (limited to 'addons/web_tour/static/src/js/debug_manager.js')
| -rw-r--r-- | addons/web_tour/static/src/js/debug_manager.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/addons/web_tour/static/src/js/debug_manager.js b/addons/web_tour/static/src/js/debug_manager.js new file mode 100644 index 00000000000..3e23207462c --- /dev/null +++ b/addons/web_tour/static/src/js/debug_manager.js @@ -0,0 +1,28 @@ +odoo.define('web_tour.DebugManager', function (require) { +"use strict"; + +var DebugManager = require('web.DebugManager'); +var Model = require('web.Model'); + +var tour = require('web_tour.tour'); + +function get_active_tours () { + return _.difference(_.keys(tour.tours), tour.consumed_tours); +} + +DebugManager.include({ + start: function () { + this.consume_tours_enabled = get_active_tours().length > 0; + return this._super.apply(this, arguments); + }, + consume_tours: function () { + var active_tours = get_active_tours(); + if (active_tours.length > 0) { // tours might have been consumed meanwhile + new Model('web_tour.tour').call('consume', [active_tours]).then(function () { + window.location.reload(); + }); + } + }, +}); + +}); |
