diff --git a/report_xlsx/__manifest__.py b/report_xlsx/__manifest__.py index 028bb184e..93492ba8f 100644 --- a/report_xlsx/__manifest__.py +++ b/report_xlsx/__manifest__.py @@ -6,12 +6,16 @@ "author": "ACSONE SA/NV," "Creu Blanca," "Odoo Community Association (OCA)", "website": "https://github.com/OCA/reporting-engine", "category": "Reporting", - "version": "14.0.1.0.4", + "version": "15.0.1.0.0", "development_status": "Production/Stable", "license": "AGPL-3", "external_dependencies": {"python": ["xlsxwriter", "xlrd"]}, "depends": ["base", "web"], - "data": ["views/webclient_templates.xml"], "demo": ["demo/report.xml"], "installable": True, + "assets": { + "web.assets_backend": [ + "report_xlsx/static/src/js/report/action_manager_report.esm.js", + ], + }, } diff --git a/report_xlsx/controllers/main.py b/report_xlsx/controllers/main.py index 01674c223..4ffb1919a 100644 --- a/report_xlsx/controllers/main.py +++ b/report_xlsx/controllers/main.py @@ -35,7 +35,7 @@ class ReportController(report.ReportController): if data["context"].get("lang"): del data["context"]["lang"] 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 if report.print_report_name and not len(docids) > 1: obj = request.env[report.model].browse(docids[0]) diff --git a/report_xlsx/models/ir_report.py b/report_xlsx/models/ir_report.py index 260ac6004..766b829b1 100644 --- a/report_xlsx/models/ir_report.py +++ b/report_xlsx/models/ir_report.py @@ -36,4 +36,4 @@ class ReportAction(models.Model): ("report_name", "=", report_name), ] 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) diff --git a/report_xlsx/static/src/js/report/action_manager_report.js b/report_xlsx/static/src/js/report/action_manager_report.esm.js similarity index 83% rename from report_xlsx/static/src/js/report/action_manager_report.js rename to report_xlsx/static/src/js/report/action_manager_report.esm.js index 212f7405d..38c69512f 100644 --- a/report_xlsx/static/src/js/report/action_manager_report.js +++ b/report_xlsx/static/src/js/report/action_manager_report.esm.js @@ -1,16 +1,14 @@ -// © 2017 Creu Blanca -// License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html). -odoo.define("report_xlsx.report", function (require) { - "use strict"; +/** @odoo-module **/ +import {download} from "@web/core/network/download"; +import {registry} from "@web/core/registry"; - var core = require("web.core"); - var ActionManager = require("web.ActionManager"); - var framework = require("web.framework"); - var session = require("web.session"); + import core from "web.core"; + import framework from "web.framework"; + import session from "web.session"; var _t = core._t; - ActionManager.include({ - _downloadReportXLSX: function (url, actions) { + + async function _downloadReportXLSX(url, actions) { var self = this; framework.blockUI(); var type = "xlsx"; @@ -59,9 +57,9 @@ odoo.define("report_xlsx.report", function (require) { this.do_warn(_t("Warning"), message, true); } }); - }, + } - _triggerDownload: function (action, options, type) { + async function _triggerDownload (action, options, type) { var self = this; var reportUrls = this._makeReportUrls(action); if (type === "xlsx") { @@ -79,20 +77,19 @@ odoo.define("report_xlsx.report", function (require) { ); } return this._super.apply(this, arguments); - }, + } - _makeReportUrls: function (action) { + async function _makeReportUrls (action) { var reportUrls = this._super.apply(this, arguments); reportUrls.xlsx = "/report/xlsx/" + action.report_name; return reportUrls; - }, + } - _executeReportAction: function (action, options) { + async function _executeReportAction (action, options) { var self = this; if (action.report_type === "xlsx") { return self._triggerDownload(action, options, "xlsx"); } return this._super.apply(this, arguments); - }, - }); -}); + } + diff --git a/report_xlsx/views/webclient_templates.xml b/report_xlsx/views/webclient_templates.xml deleted file mode 100644 index fe52398e9..000000000 --- a/report_xlsx/views/webclient_templates.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - -