mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[FIX] make prettier happy
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// © 2019 Creu Blanca
|
||||
// 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";
|
||||
|
||||
var core = require("web.core");
|
||||
@@ -10,7 +10,7 @@ odoo.define("report_csv.report", function (require) {
|
||||
var _t = core._t;
|
||||
|
||||
ActionManager.include({
|
||||
_downloadReportCSV: function (url, actions) {
|
||||
_downloadReportCSV: function(url, actions) {
|
||||
var self = this;
|
||||
framework.blockUI();
|
||||
var type = "csv";
|
||||
@@ -20,7 +20,7 @@ odoo.define("report_csv.report", function (require) {
|
||||
if (
|
||||
_.isUndefined(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) {
|
||||
report_url += "/" + cloned_action.context.active_ids.join(",");
|
||||
@@ -34,14 +34,14 @@ odoo.define("report_csv.report", function (require) {
|
||||
encodeURIComponent(JSON.stringify(cloned_action.context));
|
||||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var blocked = !session.get_file({
|
||||
url: report_url,
|
||||
data: {
|
||||
data: JSON.stringify([report_url, type]),
|
||||
},
|
||||
success: resolve,
|
||||
error: (error) => {
|
||||
error: error => {
|
||||
self.call("crash_manager", "rpc_error", error);
|
||||
reject();
|
||||
},
|
||||
@@ -54,40 +54,40 @@ odoo.define("report_csv.report", function (require) {
|
||||
var message = _t(
|
||||
"A popup window with your report was blocked. You " +
|
||||
"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);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_triggerDownload: function (action, options, type) {
|
||||
_triggerDownload: function(action, options, type) {
|
||||
var self = this;
|
||||
var reportUrls = this._makeReportUrls(action);
|
||||
if (type === "csv") {
|
||||
return this._downloadReportCSV(reportUrls[type], action).then(
|
||||
function () {
|
||||
function() {
|
||||
if (action.close_on_report_download) {
|
||||
var closeAction = {type: "ir.actions.act_window_close"};
|
||||
return self.doAction(
|
||||
closeAction,
|
||||
_.pick(options, "on_close"),
|
||||
_.pick(options, "on_close")
|
||||
);
|
||||
}
|
||||
return options.on_close();
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
_makeReportUrls: function (action) {
|
||||
_makeReportUrls: function(action) {
|
||||
var reportUrls = this._super.apply(this, arguments);
|
||||
reportUrls.csv = "/report/csv/" + action.report_name;
|
||||
return reportUrls;
|
||||
},
|
||||
|
||||
_executeReportAction: function (action, options) {
|
||||
_executeReportAction: function(action, options) {
|
||||
var self = this;
|
||||
if (action.report_type === "csv") {
|
||||
return self._triggerDownload(action, options, "csv");
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Copyright 2017-2018 ACSONE SA/NV
|
||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
||||
odoo.define("report_py3o.report", function (require) {
|
||||
odoo.define("report_py3o.report", function(require) {
|
||||
"use strict";
|
||||
|
||||
var ActionManager = require("web.ActionManager");
|
||||
|
||||
ActionManager.include({
|
||||
_executeReportAction: function (action, options) {
|
||||
_executeReportAction: function(action, options) {
|
||||
// Py3o reports
|
||||
if ("report_type" in action && action.report_type === "py3o") {
|
||||
return this._triggerDownload(action, options, "py3o");
|
||||
@@ -14,7 +14,7 @@ odoo.define("report_py3o.report", function (require) {
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
_makeReportUrls: function (action) {
|
||||
_makeReportUrls: function(action) {
|
||||
var reportUrls = this._super.apply(this, arguments);
|
||||
reportUrls.py3o = "/report/py3o/" + action.report_name;
|
||||
// We may have to build a query string with `action.data`. It's the place
|
||||
@@ -23,7 +23,7 @@ odoo.define("report_py3o.report", function (require) {
|
||||
if (
|
||||
_.isUndefined(action.data) ||
|
||||
_.isNull(action.data) ||
|
||||
_.isObject(action.data) && _.isEmpty(action.data)
|
||||
(_.isObject(action.data) && _.isEmpty(action.data))
|
||||
) {
|
||||
if (action.context.active_ids) {
|
||||
var activeIDsPath = "/" + action.context.active_ids.join(",");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// © 2017 Creu Blanca
|
||||
// License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html).
|
||||
odoo.define("report_xlsx.report", function (require) {
|
||||
odoo.define("report_xlsx.report", function(require) {
|
||||
"use strict";
|
||||
|
||||
var core = require("web.core");
|
||||
@@ -10,7 +10,7 @@ odoo.define("report_xlsx.report", function (require) {
|
||||
var _t = core._t;
|
||||
|
||||
ActionManager.include({
|
||||
_downloadReportXLSX: function (url, actions) {
|
||||
_downloadReportXLSX: function(url, actions) {
|
||||
var self = this;
|
||||
framework.blockUI();
|
||||
var type = "xlsx";
|
||||
@@ -20,7 +20,7 @@ odoo.define("report_xlsx.report", function (require) {
|
||||
if (
|
||||
_.isUndefined(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) {
|
||||
new_url += "/" + cloned_action.context.active_ids.join(",");
|
||||
@@ -34,14 +34,14 @@ odoo.define("report_xlsx.report", function (require) {
|
||||
encodeURIComponent(JSON.stringify(cloned_action.context));
|
||||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var blocked = !session.get_file({
|
||||
url: new_url,
|
||||
data: {
|
||||
data: JSON.stringify([new_url, type]),
|
||||
},
|
||||
success: resolve,
|
||||
error: (error) => {
|
||||
error: error => {
|
||||
self.call("crash_manager", "rpc_error", error);
|
||||
reject();
|
||||
},
|
||||
@@ -54,40 +54,40 @@ odoo.define("report_xlsx.report", function (require) {
|
||||
var message = _t(
|
||||
"A popup window with your report was blocked. You " +
|
||||
"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);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_triggerDownload: function (action, options, type) {
|
||||
_triggerDownload: function(action, options, type) {
|
||||
var self = this;
|
||||
var reportUrls = this._makeReportUrls(action);
|
||||
if (type === "xlsx") {
|
||||
return this._downloadReportXLSX(reportUrls[type], action).then(
|
||||
function () {
|
||||
function() {
|
||||
if (action.close_on_report_download) {
|
||||
var closeAction = {type: "ir.actions.act_window_close"};
|
||||
return self.doAction(
|
||||
closeAction,
|
||||
_.pick(options, "on_close"),
|
||||
_.pick(options, "on_close")
|
||||
);
|
||||
}
|
||||
return options.on_close();
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
_makeReportUrls: function (action) {
|
||||
_makeReportUrls: function(action) {
|
||||
var reportUrls = this._super.apply(this, arguments);
|
||||
reportUrls.xlsx = "/report/xlsx/" + action.report_name;
|
||||
return reportUrls;
|
||||
},
|
||||
|
||||
_executeReportAction: function (action, options) {
|
||||
_executeReportAction: function(action, options) {
|
||||
var self = this;
|
||||
if (action.report_type === "xlsx") {
|
||||
return self._triggerDownload(action, options, "xlsx");
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
odoo.define("report_xml.ReportActionManager", function (require) {
|
||||
odoo.define("report_xml.ReportActionManager", function(require) {
|
||||
"use strict";
|
||||
|
||||
var ActionManager = require("web.ActionManager");
|
||||
|
||||
ActionManager.include({
|
||||
_executeReportAction: function (action, options) {
|
||||
_executeReportAction: function(action, options) {
|
||||
if (action.report_type === "qweb-xml") {
|
||||
return this._triggerDownload(action, options, "xml");
|
||||
}
|
||||
return this._super(action, options);
|
||||
},
|
||||
_makeReportUrls: function (action) {
|
||||
_makeReportUrls: function(action) {
|
||||
var reportUrls = this._super(action);
|
||||
reportUrls.xml = reportUrls.text.replace("/report/text/", "/report/xml/");
|
||||
return reportUrls;
|
||||
|
||||
Reference in New Issue
Block a user