[MIG] report_xlsx: Migration to 15.0
parent
58314d62c2
commit
aec96ed82c
|
@ -6,12 +6,16 @@
|
||||||
"author": "ACSONE SA/NV," "Creu Blanca," "Odoo Community Association (OCA)",
|
"author": "ACSONE SA/NV," "Creu Blanca," "Odoo Community Association (OCA)",
|
||||||
"website": "https://github.com/OCA/reporting-engine",
|
"website": "https://github.com/OCA/reporting-engine",
|
||||||
"category": "Reporting",
|
"category": "Reporting",
|
||||||
"version": "14.0.1.0.4",
|
"version": "15.0.1.0.0",
|
||||||
"development_status": "Production/Stable",
|
"development_status": "Production/Stable",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"external_dependencies": {"python": ["xlsxwriter", "xlrd"]},
|
"external_dependencies": {"python": ["xlsxwriter", "xlrd"]},
|
||||||
"depends": ["base", "web"],
|
"depends": ["base", "web"],
|
||||||
"data": ["views/webclient_templates.xml"],
|
|
||||||
"demo": ["demo/report.xml"],
|
"demo": ["demo/report.xml"],
|
||||||
"installable": True,
|
"installable": True,
|
||||||
|
"assets": {
|
||||||
|
"web.assets_backend": [
|
||||||
|
"report_xlsx/static/src/js/report/action_manager_report.esm.js",
|
||||||
|
],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class ReportController(report.ReportController):
|
||||||
if data["context"].get("lang"):
|
if data["context"].get("lang"):
|
||||||
del data["context"]["lang"]
|
del data["context"]["lang"]
|
||||||
context.update(data["context"])
|
context.update(data["context"])
|
||||||
xlsx = report.with_context(context)._render_xlsx(docids, data=data)[0]
|
xlsx = report.with_context(**context)._render_xlsx(docids, data=data)[0]
|
||||||
report_name = report.report_file
|
report_name = report.report_file
|
||||||
if report.print_report_name and not len(docids) > 1:
|
if report.print_report_name and not len(docids) > 1:
|
||||||
obj = request.env[report.model].browse(docids[0])
|
obj = request.env[report.model].browse(docids[0])
|
||||||
|
|
|
@ -36,4 +36,4 @@ class ReportAction(models.Model):
|
||||||
("report_name", "=", report_name),
|
("report_name", "=", report_name),
|
||||||
]
|
]
|
||||||
context = self.env["res.users"].context_get()
|
context = self.env["res.users"].context_get()
|
||||||
return report_obj.with_context(context).search(conditions, limit=1)
|
return report_obj.with_context(**context).search(conditions, limit=1)
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
// © 2017 Creu Blanca
|
/** @odoo-module **/
|
||||||
// License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html).
|
import {download} from "@web/core/network/download";
|
||||||
odoo.define("report_xlsx.report", function (require) {
|
import {registry} from "@web/core/registry";
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var core = require("web.core");
|
import core from "web.core";
|
||||||
var ActionManager = require("web.ActionManager");
|
import framework from "web.framework";
|
||||||
var framework = require("web.framework");
|
import session from "web.session";
|
||||||
var session = require("web.session");
|
|
||||||
var _t = core._t;
|
var _t = core._t;
|
||||||
|
|
||||||
ActionManager.include({
|
|
||||||
_downloadReportXLSX: function (url, actions) {
|
async function _downloadReportXLSX(url, actions) {
|
||||||
var self = this;
|
var self = this;
|
||||||
framework.blockUI();
|
framework.blockUI();
|
||||||
var type = "xlsx";
|
var type = "xlsx";
|
||||||
|
@ -59,9 +57,9 @@ odoo.define("report_xlsx.report", function (require) {
|
||||||
this.do_warn(_t("Warning"), message, true);
|
this.do_warn(_t("Warning"), message, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
_triggerDownload: function (action, options, type) {
|
async function _triggerDownload (action, options, type) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var reportUrls = this._makeReportUrls(action);
|
var reportUrls = this._makeReportUrls(action);
|
||||||
if (type === "xlsx") {
|
if (type === "xlsx") {
|
||||||
|
@ -79,20 +77,19 @@ odoo.define("report_xlsx.report", function (require) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
},
|
}
|
||||||
|
|
||||||
_makeReportUrls: function (action) {
|
async function _makeReportUrls (action) {
|
||||||
var reportUrls = this._super.apply(this, arguments);
|
var reportUrls = this._super.apply(this, arguments);
|
||||||
reportUrls.xlsx = "/report/xlsx/" + action.report_name;
|
reportUrls.xlsx = "/report/xlsx/" + action.report_name;
|
||||||
return reportUrls;
|
return reportUrls;
|
||||||
},
|
}
|
||||||
|
|
||||||
_executeReportAction: function (action, options) {
|
async function _executeReportAction (action, options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
if (action.report_type === "xlsx") {
|
if (action.report_type === "xlsx") {
|
||||||
return self._triggerDownload(action, options, "xlsx");
|
return self._triggerDownload(action, options, "xlsx");
|
||||||
}
|
}
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
},
|
}
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<odoo>
|
|
||||||
<!--
|
|
||||||
© 2017 Creu Blanca
|
|
||||||
License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html).
|
|
||||||
-->
|
|
||||||
<template id="assets_backend" inherit_id="web.assets_backend">
|
|
||||||
<xpath expr="." position="inside">
|
|
||||||
<script
|
|
||||||
type="text/javascript"
|
|
||||||
src="/report_xlsx/static/src/js/report/action_manager_report.js"
|
|
||||||
/>
|
|
||||||
</xpath>
|
|
||||||
</template>
|
|
||||||
</odoo>
|
|
Loading…
Reference in New Issue