Browse Source

[FIX] report_xlsx: js

14.0
Joan Sisquella 5 years ago
committed by Alex Cuellar
parent
commit
b6adb724e9
  1. 14
      report_xlsx/static/src/js/report/action_manager_report.js

14
report_xlsx/static/src/js/report/action_manager_report.js

@ -5,7 +5,6 @@ odoo.define("report_xlsx.report", function (require) {
var core = require("web.core"); var core = require("web.core");
var ActionManager = require("web.ActionManager"); var ActionManager = require("web.ActionManager");
var crash_manager = require("web.crash_manager");
var framework = require("web.framework"); var framework = require("web.framework");
var session = require("web.session"); var session = require("web.session");
var _t = core._t; var _t = core._t;
@ -13,8 +12,8 @@ odoo.define("report_xlsx.report", function (require) {
ActionManager.include({ ActionManager.include({
_downloadReportXLSX: function (url, actions) { _downloadReportXLSX: function (url, actions) {
var self = this;
framework.blockUI(); framework.blockUI();
var def = $.Deferred();
var type = "xlsx"; var type = "xlsx";
var cloned_action = _.clone(actions); var cloned_action = _.clone(actions);
var new_url = url; var new_url = url;
@ -32,15 +31,16 @@ odoo.define("report_xlsx.report", function (require) {
JSON.stringify(cloned_action.context)); JSON.stringify(cloned_action.context));
} }
return new Promise(function (resolve, reject) {
var blocked = !session.get_file({ var blocked = !session.get_file({
url: new_url, url: new_url,
data: { data: {
data: JSON.stringify([new_url, type]), data: JSON.stringify([new_url, type]),
}, },
success: def.resolve.bind(def),
error: function () {
crash_manager.rpc_error.apply(crash_manager, arguments);
def.reject();
success: resolve,
error: (error) => {
self.call('crash_manager', 'rpc_error', error);
reject();
}, },
complete: framework.unblockUI, complete: framework.unblockUI,
}); });
@ -53,7 +53,7 @@ odoo.define("report_xlsx.report", function (require) {
'popup windows for this page.'); 'popup windows for this page.');
this.do_warn(_t('Warning'), message, true); this.do_warn(_t('Warning'), message, true);
} }
return def;
});
}, },
_triggerDownload: function (action, options, type) { _triggerDownload: function (action, options, type) {

Loading…
Cancel
Save