diff --git a/addons/web_tour/static/src/js/tour_manager.js b/addons/web_tour/static/src/js/tour_manager.js index f4055acfcef..cb7f02dba5d 100644 --- a/addons/web_tour/static/src/js/tour_manager.js +++ b/addons/web_tour/static/src/js/tour_manager.js @@ -64,6 +64,9 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, { * sequence will be executed in a non deterministic order). * @param {Promise} [options.wait_for] * indicates when the tour can be started + * @param {string|function} [options.rainbowManMessage] + text or function returning the text displayed under the rainbowman + at the end of the tour. * @param {Object[]} steps - steps' descriptions, each step being an object * containing a tip description */ @@ -396,8 +399,12 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, { //display rainbow at the end of any tour if (this.tours[tour_name].rainbowMan && this.running_tour !== tour_name && this.tours[tour_name].current_step === this.tours[tour_name].steps.length) { - const message = this.tours[tour_name].rainbowManMessage || - _t('Good job! You went through all steps of this tour.'); + let message = this.tours[tour_name].rainbowManMessage; + if (message) { + message = typeof message === 'function' ? message() : message; + } else { + message = _t('Good job! You went through all steps of this tour.'); + } const fadeout = this.tours[tour_name].fadeout; new RainbowMan({message, fadeout}).appendTo(this.$body); }