summaryrefslogtreecommitdiff
path: root/addons/odoo_referral/static/src
diff options
context:
space:
mode:
authorSwapnesh Shah <swapneshshah111@gmail.com>2020-04-27 16:39:05 +0000
committerGitHub <noreply@github.com>2020-05-11 10:17:20 +0000
commit28a68b6bc585fd92eea6b71b8007fd9751096e01 (patch)
treeb5e02a2404162a07dc53908cd2358671f2156938 /addons/odoo_referral/static/src
parent665c2d536ffcc0ec9bb6fe6d9e9cc7e06fd3d805 (diff)
[FIX] odoo_referral: notify user if popup is blocked
Before this, User was unaware of the fact that Popup might be blocked which due to which window won't be opened. With this commit, We notify users about that. closes odoo/odoo#51015 X-original-commit: 393f417ce0d437118fc1ba72f05caeeb42ca70f4 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons/odoo_referral/static/src')
-rw-r--r--addons/odoo_referral/static/src/js/systray.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/addons/odoo_referral/static/src/js/systray.js b/addons/odoo_referral/static/src/js/systray.js
index 4af107d8b7c..4b29fd36e61 100644
--- a/addons/odoo_referral/static/src/js/systray.js
+++ b/addons/odoo_referral/static/src/js/systray.js
@@ -1,9 +1,11 @@
odoo.define('systray.systray_odoo_referral', function (require) {
"use strict";
+ var core = require('web.core');
var localStorage = require('web.local_storage');
var SystrayMenu = require('web.SystrayMenu');
var Widget = require('web.Widget');
+ var _t = core._t;
var ActionMenu = Widget.extend({
template: 'systray_odoo_referral.gift_icon',
events: {
@@ -44,7 +46,13 @@ odoo.define('systray.systray_odoo_referral', function (require) {
}).then(function (result) {
localStorage.setItem('odoo_referral.has_clicked', 1);
self.$('.o_notification_counter').text('');
- window.open(result.link, '_blank', 'noopener noreferrer');
+ var w = window.open(result.link, '_blank', 'noreferrer noopener');
+ if (!w || w.closed || typeof w.closed === 'undefined') {
+ var message = _t('A popup window has been blocked. You ' +
+ 'may need to change your browser settings to allow ' +
+ 'popup windows for this page.');
+ self.do_warn(_t('Warning'), message, true);
+ }
});
},
});