From 115559802ec9611be055f5bf4b83733a396aedeb Mon Sep 17 00:00:00 2001 From: Tran Thanh Phuc Date: Sun, 15 May 2022 22:18:31 +0700 Subject: [PATCH] [MIG] report_py3o: Migration to 15.0 --- report_py3o/README.rst | 11 ++-- report_py3o/__manifest__.py | 13 +++-- report_py3o/controllers/main.py | 8 +-- report_py3o/models/ir_actions_report.py | 4 +- report_py3o/readme/CONTRIBUTORS.rst | 2 + report_py3o/static/description/index.html | 9 ++-- .../static/src/js/py3oactionmanager.js | 42 --------------- .../static/src/js/py3oactionservice.esm.js | 54 +++++++++++++++++++ report_py3o/tests/test_report_py3o.py | 2 +- report_py3o/views/py3o_template.xml | 4 +- report_py3o/views/report_py3o.xml | 11 ---- 11 files changed, 85 insertions(+), 75 deletions(-) delete mode 100644 report_py3o/static/src/js/py3oactionmanager.js create mode 100644 report_py3o/static/src/js/py3oactionservice.esm.js delete mode 100644 report_py3o/views/report_py3o.xml diff --git a/report_py3o/README.rst b/report_py3o/README.rst index 1935e99219..9e3b355d28 100644 --- a/report_py3o/README.rst +++ b/report_py3o/README.rst @@ -14,13 +14,13 @@ Py3o Report Engine :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github - :target: https://github.com/OCA/reporting-engine/tree/14.0/report_py3o + :target: https://github.com/OCA/reporting-engine/tree/15.0/report_py3o :alt: OCA/reporting-engine .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/reporting-engine-14-0/reporting-engine-14-0-report_py3o + :target: https://translation.odoo-community.org/projects/reporting-engine-15-0/reporting-engine-15-0-report_py3o :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/143/14.0 + :target: https://runbot.odoo-community.org/runbot/143/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -203,7 +203,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. 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 -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -225,6 +225,7 @@ Contributors * Guewen Baconnier * Omar Castiñeira * Holger Brunn +* Phuc Tran Thanh Maintainers ~~~~~~~~~~~ @@ -239,6 +240,6 @@ 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. -This module is part of the `OCA/reporting-engine `_ project on GitHub. +This module is part of the `OCA/reporting-engine `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/report_py3o/__manifest__.py b/report_py3o/__manifest__.py index 5f35b7846f..96e04f9c4c 100644 --- a/report_py3o/__manifest__.py +++ b/report_py3o/__manifest__.py @@ -4,19 +4,26 @@ "name": "Py3o Report Engine", "summary": "Reporting engine based on Libreoffice (ODT -> ODT, " "ODT -> PDF, ODT -> DOC, ODT -> DOCX, ODS -> ODS, etc.)", - "version": "14.0.1.0.0", + "version": "15.0.1.0.0", "category": "Reporting", "license": "AGPL-3", "author": "XCG Consulting," "ACSONE SA/NV," "Odoo Community Association (OCA)", "website": "https://github.com/OCA/reporting-engine", "depends": ["web"], - "external_dependencies": {"python": ["py3o.template", "py3o.formats", "PyPDF2"]}, + "external_dependencies": { + "python": ["py3o.template", "py3o.formats", "PyPDF2"], + "deb": ["libreoffice"], + }, + "assets": { + "web.assets_backend": [ + "report_py3o/static/src/js/py3oactionservice.esm.js", + ], + }, "data": [ "security/ir.model.access.csv", "views/menu.xml", "views/py3o_template.xml", "views/ir_actions_report.xml", - "views/report_py3o.xml", "demo/report_py3o.xml", ], "installable": True, diff --git a/report_py3o/controllers/main.py b/report_py3o/controllers/main.py index c26fee9fb9..8f28cdd436 100644 --- a/report_py3o/controllers/main.py +++ b/report_py3o/controllers/main.py @@ -38,7 +38,7 @@ def report_routes(self, reportname, docids=None, converter=None, **data): ir_action = request.env["ir.actions.report"] action_py3o_report = ir_action.get_from_report_name( reportname, "py3o" - ).with_context(context) + ).with_context(**context) if not action_py3o_report: raise exceptions.HTTPException( description="Py3o action report not found for report_name " @@ -57,7 +57,7 @@ def report_routes(self, reportname, docids=None, converter=None, **data): return request.make_response(res, headers=http_headers) @route() - def report_download(self, data, token): + def report_download(self, data, context=None): """This function is used by 'qwebactionmanager.js' in order to trigger the download of a py3o/controller report. @@ -68,7 +68,7 @@ def report_download(self, data, token): requestcontent = json.loads(data) url, report_type = requestcontent[0], requestcontent[1] if "py3o" not in report_type: - return super(ReportController, self).report_download(data, token) + return super(ReportController, self).report_download(data, context) try: reportname = url.split("/report/py3o/")[1].split("?")[0] docids = None @@ -87,7 +87,7 @@ def report_download(self, data, token): response = self.report_routes( reportname, converter="py3o", **dict(data) ) - response.set_cookie("fileToken", token) + response.set_cookie("fileToken", context) return response except Exception as e: se = _serialize_exception(e) diff --git a/report_py3o/models/ir_actions_report.py b/report_py3o/models/ir_actions_report.py index 0eda94082f..65955521e0 100644 --- a/report_py3o/models/ir_actions_report.py +++ b/report_py3o/models/ir_actions_report.py @@ -58,9 +58,7 @@ def _get_py3o_filetypes(self): ) is_py3o_native_format = fields.Boolean(compute="_compute_is_py3o_native_format") py3o_template_id = fields.Many2one("py3o.template", "Template") - module = fields.Char( - "Module", help="The implementer module that provides this report" - ) + module = fields.Char(help="The implementer module that provides this report") py3o_template_fallback = fields.Char( "Fallback", size=128, diff --git a/report_py3o/readme/CONTRIBUTORS.rst b/report_py3o/readme/CONTRIBUTORS.rst index ed9db7339a..c36c4cc6e3 100644 --- a/report_py3o/readme/CONTRIBUTORS.rst +++ b/report_py3o/readme/CONTRIBUTORS.rst @@ -4,3 +4,5 @@ * Guewen Baconnier * Omar Castiñeira * Holger Brunn +* Phuc Tran Thanh +* Alexandre D. Díaz (`Grupo Isonor `_) diff --git a/report_py3o/static/description/index.html b/report_py3o/static/description/index.html index 5b63f15084..282cb7fe0d 100644 --- a/report_py3o/static/description/index.html +++ b/report_py3o/static/description/index.html @@ -3,7 +3,7 @@ - + Py3o Report Engine