summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/widgets/rainbow_man.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2019-02-06 12:49:18 +0000
committerYannick Tivisse <yti@odoo.com>2019-02-06 12:58:58 +0000
commit791b1bd839afd7b29e65631615910f0eb7c37b2e (patch)
treea6c2e13bfbc8a7a3e3ef0cdc71b0e9ea1af10fe2 /addons/web/static/src/js/widgets/rainbow_man.js
parent152af348f3ee7f320dec23eac98fd3903a56eb97 (diff)
[IMP] web: Set a timeout on rainbow man destruction
Avoid traceback when the click that triggered the rainbow man is the click that closes it. Example: The last step of a tour. closes odoo/odoo#29969
Diffstat (limited to 'addons/web/static/src/js/widgets/rainbow_man.js')
-rw-r--r--addons/web/static/src/js/widgets/rainbow_man.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/addons/web/static/src/js/widgets/rainbow_man.js b/addons/web/static/src/js/widgets/rainbow_man.js
index 99a8f9dba79..fa1b1fac351 100644
--- a/addons/web/static/src/js/widgets/rainbow_man.js
+++ b/addons/web/static/src/js/widgets/rainbow_man.js
@@ -30,7 +30,7 @@ var RainbowMan = Widget.extend({
*/
init: function (options) {
this._super.apply(this, arguments);
- var rainbowDelay = {slow: 4500, medium: 3500, fast:2000, no: false };
+ var rainbowDelay = {slow: 4500, medium: 3500, fast: 2000, no: false};
this.options = _.defaults(options || {}, {
fadeout: 'medium',
img_url: '/web/static/src/img/smile.svg',
@@ -43,10 +43,15 @@ var RainbowMan = Widget.extend({
*/
start: function () {
var self = this;
- core.bus.on('click', this, function (ev) {
- if (ev.originalEvent && ev.target.className.indexOf('o_reward') === -1) {
- this.destroy();
- }
+ // destroy rainbow man when the user clicks outside
+ // this is done in a setTimeout to prevent the click that triggered the
+ // rainbow man to close it directly
+ setTimeout(function () {
+ core.bus.on('click', self, function (ev) {
+ if (ev.originalEvent && ev.target.className.indexOf('o_reward') === -1) {
+ this.destroy();
+ }
+ });
});
if (this.delay) {
setTimeout(function () {