summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core/ajax.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-10-20 19:27:04 +0200
committerChristophe Simonis <chs@odoo.com>2017-10-20 19:27:04 +0200
commit10128fa7e8c743e9c838743204fb8116bcdeefd6 (patch)
tree7ffbf2540d01f994886369bd551ea59f7e446040 /addons/web/static/src/js/core/ajax.js
parent68bef91d733aaf8f08df5f3daf0821a4c59d4d87 (diff)
parentdc2a6c6cd2a281b7d9e5d33d8e37d2f6b15d7e78 (diff)
[MERGE] forward port branch saas-16 up to dc2a6c6cd2a
Diffstat (limited to 'addons/web/static/src/js/core/ajax.js')
-rw-r--r--addons/web/static/src/js/core/ajax.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/addons/web/static/src/js/core/ajax.js b/addons/web/static/src/js/core/ajax.js
index d69574d2e10..0ee6d2ad1ed 100644
--- a/addons/web/static/src/js/core/ajax.js
+++ b/addons/web/static/src/js/core/ajax.js
@@ -212,6 +212,9 @@ var loadJS = (function () {
* @param {Function} [options.success] callback in case of download success
* @param {Function} [options.error] callback in case of request error, provided with the error body
* @param {Function} [options.complete] called after both ``success`` and ``error`` callbacks have executed
+ * @returns {boolean} a false value means that a popup window was blocked. This
+ * mean that we probably need to inform the user that something needs to be
+ * changed to make it work.
*/
function get_file(options) {
// need to detect when the file is done downloading (not used
@@ -232,7 +235,12 @@ function get_file(options) {
var url = options.session.url(options.url, params);
if (options.complete) { options.complete(); }
- return window.open(url);
+ var w = window.open(url);
+ if (!w || w.closed || typeof w.closed === 'undefined') {
+ // popup was blocked
+ return false;
+ }
+ return true;
}
var $form, $form_data = $('<div>');
@@ -309,6 +317,7 @@ function get_file(options) {
}
};
timer = setTimeout(waitLoop, CHECK_INTERVAL);
+ return true;
};
function post (controller_url, data) {