From 58acf26ea43a6dfbd30c06b5e3c196305019e462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rahir?= Date: Fri, 18 May 2018 15:57:15 +0200 Subject: [PATCH] [IMP] web: improve act_url By default, Chrome browser will block pop-up windows which will block all actions from type act_url with a different target than 'self' (i.e. '_blank'). This commit adds a check when such an action is called and sends a warning in the web client when it fails to open. This mimics the behaviour already present for the report actions. --- addons/web/static/src/js/chrome/action_manager.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/chrome/action_manager.js b/addons/web/static/src/js/chrome/action_manager.js index b36e1b8eec9..8ae6d93bc58 100644 --- a/addons/web/static/src/js/chrome/action_manager.js +++ b/addons/web/static/src/js/chrome/action_manager.js @@ -22,6 +22,7 @@ var framework = require('web.framework'); var pyeval = require('web.pyeval'); var Widget = require('web.Widget'); +var _t = core._t; var ActionManager = Widget.extend({ className: 'o_content', custom_events: { @@ -547,7 +548,13 @@ var ActionManager = Widget.extend({ framework.redirect(url); return $.Deferred(); } else { - window.open(url, '_blank'); + var w = window.open(url, '_blank'); +         if (!w || w.closed || typeof w.closed === 'undefined') { +             var message = _t('A popup window was blocked. You ' + + 'may need to change your browser settings to allow ' + + 'popup windows for this page.'); + this.do_warn(_t('Warning'), message, true); +         } } options.on_close();