mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[MIG] report_py3o: Migration to 15.0
This commit is contained in:
committed by
Alexandre D. Díaz
parent
19335d8a3e
commit
115559802e
@@ -3,7 +3,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
|
||||
<title>Py3o Report Engine</title>
|
||||
<style type="text/css">
|
||||
|
||||
@@ -367,7 +367,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/14.0/report_py3o"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/reporting-engine-14-0/reporting-engine-14-0-report_py3o"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/143/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/15.0/report_py3o"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/reporting-engine-15-0/reporting-engine-15-0-report_py3o"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/143/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>The py3o reporting engine is a reporting engine for Odoo based on <a class="reference external" href="http://www.libreoffice.org/">Libreoffice</a>:</p>
|
||||
<ul class="simple">
|
||||
<li>the report is created with Libreoffice (ODT or ODS),</li>
|
||||
@@ -546,7 +546,7 @@ root_tmpl_path=/odoo/templates/py3o
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/reporting-engine/issues">GitHub Issues</a>.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_py3o%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_py3o%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
@@ -567,6 +567,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<li>Guewen Baconnier <<a class="reference external" href="mailto:guewen.baconnier@camptocamp.com">guewen.baconnier@camptocamp.com</a>></li>
|
||||
<li>Omar Castiñeira <<a class="reference external" href="mailto:omar@comunitea.com">omar@comunitea.com</a>></li>
|
||||
<li>Holger Brunn <<a class="reference external" href="mailto:hbrunn@therp.nl">hbrunn@therp.nl</a>></li>
|
||||
<li>Phuc Tran Thanh <<a class="reference external" href="mailto:phuc@trobz.com">phuc@trobz.com</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
@@ -576,7 +577,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/14.0/report_py3o">OCA/reporting-engine</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/15.0/report_py3o">OCA/reporting-engine</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/* 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) {
|
||||
"use strict";
|
||||
|
||||
var ActionManager = require("web.ActionManager");
|
||||
|
||||
ActionManager.include({
|
||||
_executeReportAction: function (action, options) {
|
||||
// Py3o reports
|
||||
if ("report_type" in action && action.report_type === "py3o") {
|
||||
return this._triggerDownload(action, options, "py3o");
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
_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
|
||||
// were report's using a wizard to customize the output traditionally put
|
||||
// their options.
|
||||
if (
|
||||
_.isUndefined(action.data) ||
|
||||
_.isNull(action.data) ||
|
||||
(_.isObject(action.data) && _.isEmpty(action.data))
|
||||
) {
|
||||
if (action.context.active_ids) {
|
||||
var activeIDsPath = "/" + action.context.active_ids.join(",");
|
||||
reportUrls.py3o += activeIDsPath;
|
||||
}
|
||||
} else {
|
||||
var serializedOptionsPath =
|
||||
"?options=" + encodeURIComponent(JSON.stringify(action.data));
|
||||
serializedOptionsPath +=
|
||||
"&context=" + encodeURIComponent(JSON.stringify(action.context));
|
||||
reportUrls.py3o += serializedOptionsPath;
|
||||
}
|
||||
return reportUrls;
|
||||
},
|
||||
});
|
||||
});
|
||||
54
report_py3o/static/src/js/py3oactionservice.esm.js
Normal file
54
report_py3o/static/src/js/py3oactionservice.esm.js
Normal file
@@ -0,0 +1,54 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import {download} from "@web/core/network/download";
|
||||
import {registry} from "@web/core/registry";
|
||||
|
||||
registry
|
||||
.category("ir.actions.report handlers")
|
||||
.add("py3o_handler", async function (action, options, env) {
|
||||
if (action.report_type === "py3o") {
|
||||
let url = `/report/py3o/${action.report_name}`;
|
||||
const actionContext = action.context || {};
|
||||
if (
|
||||
_.isUndefined(action.data) ||
|
||||
_.isNull(action.data) ||
|
||||
(_.isObject(action.data) && _.isEmpty(action.data))
|
||||
) {
|
||||
// Build a query string with `action.data` (it's the place where reports
|
||||
// using a wizard to customize the output traditionally put their options)
|
||||
if (actionContext.active_ids) {
|
||||
var activeIDsPath = "/" + actionContext.active_ids.join(",");
|
||||
url += activeIDsPath;
|
||||
}
|
||||
} else {
|
||||
var serializedOptionsPath =
|
||||
"?options=" + encodeURIComponent(JSON.stringify(action.data));
|
||||
serializedOptionsPath +=
|
||||
"&context=" + encodeURIComponent(JSON.stringify(actionContext));
|
||||
url += serializedOptionsPath;
|
||||
}
|
||||
env.services.ui.block();
|
||||
try {
|
||||
await download({
|
||||
url: "/report/download",
|
||||
data: {
|
||||
data: JSON.stringify([url, action.report_type]),
|
||||
context: JSON.stringify(env.services.user.context),
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
env.services.ui.unblock();
|
||||
}
|
||||
const onClose = options.onClose;
|
||||
if (action.close_on_report_download) {
|
||||
return env.services.action.doAction(
|
||||
{type: "ir.actions.act_window_close"},
|
||||
{onClose}
|
||||
);
|
||||
} else if (onClose) {
|
||||
onClose();
|
||||
}
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
return Promise.resolve(false);
|
||||
});
|
||||
Reference in New Issue
Block a user