[FIX] report_py3o: prettier xml after merge with master

This commit is contained in:
Laurent Mignon (ACSONE)
2020-05-12 17:02:14 +02:00
committed by ferran-73
parent 5c018e9ce0
commit 7b874a3e33

View File

@@ -1,6 +1,6 @@
// © 2019 Creu Blanca // © 2019 Creu Blanca
// License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html). // License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html).
odoo.define("report_csv.report", function(require) { odoo.define("report_csv.report", function (require) {
"use strict"; "use strict";
var core = require("web.core"); var core = require("web.core");
@@ -10,7 +10,7 @@ odoo.define("report_csv.report", function(require) {
var _t = core._t; var _t = core._t;
ActionManager.include({ ActionManager.include({
_downloadReportCSV: function(url, actions) { _downloadReportCSV: function (url, actions) {
var self = this; var self = this;
framework.blockUI(); framework.blockUI();
var type = "csv"; var type = "csv";
@@ -19,7 +19,7 @@ odoo.define("report_csv.report", function(require) {
if ( if (
_.isUndefined(cloned_action.data) || _.isUndefined(cloned_action.data) ||
_.isNull(cloned_action.data) || _.isNull(cloned_action.data) ||
(_.isObject(cloned_action.data) && _.isEmpty(cloned_action.data)) _.isObject(cloned_action.data) && _.isEmpty(cloned_action.data)
) { ) {
if (cloned_action.context.active_ids) { if (cloned_action.context.active_ids) {
url += "/" + cloned_action.context.active_ids.join(","); url += "/" + cloned_action.context.active_ids.join(",");
@@ -33,14 +33,14 @@ odoo.define("report_csv.report", function(require) {
encodeURIComponent(JSON.stringify(cloned_action.context)); encodeURIComponent(JSON.stringify(cloned_action.context));
} }
return new Promise(function(resolve, reject) { return new Promise(function (resolve, reject) {
var blocked = !session.get_file({ var blocked = !session.get_file({
url: url, url: url,
data: { data: {
data: JSON.stringify([url, type]), data: JSON.stringify([url, type]),
}, },
success: resolve, success: resolve,
error: error => { error: (error) => {
self.call("crash_manager", "rpc_error", error); self.call("crash_manager", "rpc_error", error);
reject(); reject();
}, },
@@ -53,40 +53,40 @@ odoo.define("report_csv.report", function(require) {
var message = _t( var message = _t(
"A popup window with your report was blocked. You " + "A popup window with your report was blocked. You " +
"may need to change your browser settings to allow " + "may need to change your browser settings to allow " +
"popup windows for this page." "popup windows for this page.",
); );
this.do_warn(_t("Warning"), message, true); this.do_warn(_t("Warning"), message, true);
} }
}); });
}, },
_triggerDownload: function(action, options, type) { _triggerDownload: function (action, options, type) {
var self = this; var self = this;
var reportUrls = this._makeReportUrls(action); var reportUrls = this._makeReportUrls(action);
if (type === "csv") { if (type === "csv") {
return this._downloadReportCSV(reportUrls[type], action).then( return this._downloadReportCSV(reportUrls[type], action).then(
function() { function () {
if (action.close_on_report_download) { if (action.close_on_report_download) {
var closeAction = {type: "ir.actions.act_window_close"}; var closeAction = {type: "ir.actions.act_window_close"};
return self.doAction( return self.doAction(
closeAction, closeAction,
_.pick(options, "on_close") _.pick(options, "on_close"),
); );
} }
return options.on_close(); return options.on_close();
} },
); );
} }
return this._super.apply(this, arguments); return this._super.apply(this, arguments);
}, },
_makeReportUrls: function(action) { _makeReportUrls: function (action) {
var reportUrls = this._super.apply(this, arguments); var reportUrls = this._super.apply(this, arguments);
reportUrls.csv = "/report/csv/" + action.report_name; reportUrls.csv = "/report/csv/" + action.report_name;
return reportUrls; return reportUrls;
}, },
_executeReportAction: function(action, options) { _executeReportAction: function (action, options) {
var self = this; var self = this;
if (action.report_type === "csv") { if (action.report_type === "csv") {
return self._triggerDownload(action, options, "csv"); return self._triggerDownload(action, options, "csv");