From 32a4fa90f7b1756c276e55fff4d2756d07727886 Mon Sep 17 00:00:00 2001 From: Ernad Husremovic Date: Mon, 9 Mar 2026 22:16:29 +0100 Subject: [PATCH] update: report_xlsx to OCA 19.0 version (19.0.1.0.2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 assisted by claude --- .../report_xlsx/README.rst | 113 ++++++++++-------- .../report_xlsx/__manifest__.py | 5 +- .../report_xlsx/controllers/main.py | 20 ++-- .../report_xlsx/i18n/bs.po | 53 -------- .../report_xlsx/i18n/fr.po | 21 ++-- .../report_xlsx/i18n/hr.po | 4 +- .../report_xlsx/i18n/hr_HR.po | 4 +- .../report_xlsx/i18n/it.po | 2 +- .../report_xlsx/i18n/report_xlsx.pot | 19 ++- .../report_xlsx/i18n/sv.po | 8 +- .../report_xlsx/i18n/tr.po | 21 ++-- .../report_xlsx/models/ir_report.py | 4 +- .../report_xlsx/pyproject.toml | 3 + .../report_xlsx/readme/CONTRIBUTORS.md | 11 ++ .../report_xlsx/readme/CONTRIBUTORS.rst | 10 -- .../{DESCRIPTION.rst => DESCRIPTION.md} | 0 .../report_xlsx/readme/INSTALL.md | 7 ++ .../report_xlsx/readme/INSTALL.rst | 7 -- .../readme/{USAGE.rst => USAGE.md} | 11 +- .../report/report_abstract_xlsx.py | 4 +- .../report_xlsx/static/description/index.html | 45 ++++--- .../js/report/action_manager_report.esm.js | 9 +- .../report_xlsx/tests/test_report.py | 26 ++-- 23 files changed, 201 insertions(+), 206 deletions(-) delete mode 100644 odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/bs.po create mode 100644 odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/pyproject.toml create mode 100644 odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/CONTRIBUTORS.md delete mode 100644 odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/CONTRIBUTORS.rst rename odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/{DESCRIPTION.rst => DESCRIPTION.md} (100%) create mode 100644 odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/INSTALL.md delete mode 100644 odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/INSTALL.rst rename odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/{USAGE.rst => USAGE.md} (80%) diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/README.rst b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/README.rst index b938196..e652e44 100644 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/README.rst +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/README.rst @@ -1,3 +1,7 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + ================ Base report xlsx ================ @@ -7,23 +11,23 @@ Base report xlsx !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:1b8ed9ba68eb80158d4a236896a641b3ef8f79c2068525b03d67d67e72d20dcd + !! source digest: sha256:61af5f70a44c329b90fa1b3c7e98e743299c3bb6c1d8c385563d620f18d835e9 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png :target: https://odoo-community.org/page/development-status :alt: Mature -.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png :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/16.0/report_xlsx + :target: https://github.com/OCA/reporting-engine/tree/19.0/report_xlsx :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-16-0/reporting-engine-16-0-report_xlsx + :target: https://translation.odoo-community.org/projects/reporting-engine-19-0/reporting-engine-19-0-report_xlsx :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=19.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -38,50 +42,60 @@ This module provides a basic report class to generate xlsx report. Installation ============ -Make sure you have ``xlsxwriter`` Python module installed:: +Make sure you have ``xlsxwriter`` Python module installed: -$ pip3 install xlsxwriter +:: -For testing it is also necessary ``xlrd`` Python module installed:: + $ pip3 install xlsxwriter -$ pip3 install xlrd +For testing it is also necessary ``xlrd`` Python module installed: + +:: + + $ pip3 install xlrd Usage ===== -An example of XLSX report for partners on a module called `module_name`: +An example of XLSX report for partners on a module called +\`module_name\`: -A python class :: +A python class : - from odoo import models +:: - class PartnerXlsx(models.AbstractModel): - _name = 'report.module_name.report_name' - _inherit = 'report.report_xlsx.abstract' + from odoo import models - def generate_xlsx_report(self, workbook, data, partners): - for obj in partners: - report_name = obj.name - # One sheet by partner - sheet = workbook.add_worksheet(report_name[:31]) - bold = workbook.add_format({'bold': True}) - sheet.write(0, 0, obj.name, bold) + class PartnerXlsx(models.AbstractModel): + _name = 'report.module_name.report_name' + _inherit = 'report.report_xlsx.abstract' + + def generate_xlsx_report(self, workbook, data, partners): + for obj in partners: + report_name = obj.name + # One sheet by partner + sheet = workbook.add_worksheet(report_name[:31]) + bold = workbook.add_format({'bold': True}) + sheet.write(0, 0, obj.name, bold) To manipulate the ``workbook`` and ``sheet`` objects, refer to the -`documentation `_ of ``xlsxwriter``. +`documentation `__ of +``xlsxwriter``. -A report XML record :: +A report XML record : - - Print to XLSX - res.partner - xlsx - module_name.report_name - module_name.report_file - - report - - +:: + + + Print to XLSX + res.partner + xlsx + module_name.report_name + module_name.report_file + + report + + Bug Tracker =========== @@ -89,7 +103,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 to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -97,27 +111,28 @@ Credits ======= Authors -~~~~~~~ +------- * ACSONE SA/NV * Creu Blanca Contributors -~~~~~~~~~~~~ +------------ -* Adrien Peiffer -* Sébastien Alix -* Stéphane Bidoul -* Enric Tobella -* Graeme Gellatly -* Cristian Salamea -* Rod Schouteden -* Eugene Molotov -* Christopher Ormaza -* Houzéfa Abbasbhay +- Adrien Peiffer +- Sébastien Alix +- Stéphane Bidoul +- Enric Tobella +- Graeme Gellatly +- Cristian Salamea +- Rod Schouteden +- Eugene Molotov +- Christopher Ormaza +- Houzéfa Abbasbhay +- Le Dinh Tien Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -129,6 +144,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/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/__manifest__.py b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/__manifest__.py index cfb9f5c..5feb21b 100644 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/__manifest__.py +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/__manifest__.py @@ -3,12 +3,13 @@ { "name": "Base report xlsx", "summary": "Base module to create xlsx report", - "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", "category": "Reporting", - "version": "16.0.2.0.2", + "version": "19.0.1.0.2", "development_status": "Mature", "license": "AGPL-3", + "external_dependencies": {"python": ["xlsxwriter", "xlrd"]}, "depends": ["base", "web"], "demo": ["demo/report.xml"], "installable": True, diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/controllers/main.py b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/controllers/main.py index 2fce11d..5430532 100644 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/controllers/main.py +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/controllers/main.py @@ -11,6 +11,8 @@ from odoo.http import ( content_disposition, request, route, +) +from odoo.http import ( serialize_exception as _serialize_exception, ) from odoo.tools import html_escape @@ -40,8 +42,7 @@ class ReportController(ReportController): xlsxhttpheaders = [ ( "Content-Type", - "application/vnd.openxmlformats-" - "officedocument.spreadsheetml.sheet", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", ), ("Content-Length", len(xlsx)), ] @@ -49,7 +50,7 @@ class ReportController(ReportController): return super().report_routes(reportname, docids, converter, **data) @route() - def report_download(self, data, context=None, token=None): + def report_download(self, data, context=None, token=None, readonly=True): requestcontent = json.loads(data) url, report_type = requestcontent[0], requestcontent[1] if report_type == "xlsx": @@ -69,8 +70,9 @@ class ReportController(ReportController): url_decode(url.split("?")[1]).items() ) # decoding the args represented in JSON if "context" in data: - context, data_context = json.loads(context or "{}"), json.loads( - data.pop("context") + context, data_context = ( + json.loads(context or "{}"), + json.loads(data.pop("context")), ) context = json.dumps({**context, **data_context}) response = self.report_routes( @@ -80,7 +82,7 @@ class ReportController(ReportController): report = request.env["ir.actions.report"]._get_report_from_name( reportname ) - filename = "%s.%s" % (report.name, "xlsx") + filename = f"{report.name}.xlsx" if docids: ids = [int(x) for x in docids.split(",")] @@ -89,7 +91,7 @@ class ReportController(ReportController): report_name = safe_eval( report.print_report_name, {"object": obj, "time": time} ) - filename = "%s.%s" % (report_name, "xlsx") + filename = f"{report_name}.xlsx" if not response.headers.get("Content-Disposition"): response.headers.add( "Content-Disposition", content_disposition(filename) @@ -101,4 +103,6 @@ class ReportController(ReportController): error = {"code": 200, "message": "Odoo Server Error", "data": se} return request.make_response(html_escape(json.dumps(error))) else: - return super().report_download(data, context=context, token=token) + return super().report_download( + data, context, token=token, readonly=readonly + ) diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/bs.po b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/bs.po deleted file mode 100644 index a60f6c9..0000000 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/bs.po +++ /dev/null @@ -1,53 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * report_xlsx -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" -"Report-Msgid-Bugs-To: \n" -"Last-Translator: \n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: report_xlsx -#: model:ir.model,name:report_xlsx.model_report_report_xlsx_abstract -msgid "Abstract XLSX Report" -msgstr "Apstraktni XLSX izvještaj" - -#. module: report_xlsx -#: model:ir.model,name:report_xlsx.model_report_report_xlsx_partner_xlsx -msgid "Partner XLSX Report" -msgstr "XLSX izvještaj o partnerima" - -#. module: report_xlsx -#: model:ir.actions.report,name:report_xlsx.partner_xlsx -msgid "Print to XLSX" -msgstr "Štampaj u XLSX" - -#. module: report_xlsx -#: model:ir.model,name:report_xlsx.model_ir_actions_report -msgid "Report Action" -msgstr "Akcija izvještaja" - -#. module: report_xlsx -#: model:ir.model.fields,field_description:report_xlsx.field_ir_actions_report__report_type -msgid "Report Type" -msgstr "Tip izvještaja" - -#. module: report_xlsx -#: model:ir.model.fields,help:report_xlsx.field_ir_actions_report__report_type -msgid "" -"The type of the report that will be rendered, each one having its own " -"rendering method. HTML means the report will be opened directly in your " -"browser PDF means the report will be rendered using Wkhtmltopdf and " -"downloaded by the user." -msgstr "" - -#. module: report_xlsx -#: model:ir.model.fields.selection,name:report_xlsx.selection__ir_actions_report__report_type__xlsx -msgid "XLSX" -msgstr "XLSX" diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/fr.po b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/fr.po index 75fdb3a..148ebbd 100644 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/fr.po +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/fr.po @@ -9,25 +9,24 @@ msgstr "" "Project-Id-Version: Odoo Server 11.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-01-05 17:53+0000\n" -"PO-Revision-Date: 2024-12-31 15:06+0000\n" -"Last-Translator: samibc2c \n" +"PO-Revision-Date: 2018-01-05 17:53+0000\n" +"Last-Translator: Nicolas JEUDY , 2018\n" "Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 5.6.2\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" #. module: report_xlsx #: model:ir.model,name:report_xlsx.model_report_report_xlsx_abstract msgid "Abstract XLSX Report" -msgstr "Rapport résumé XLSX" +msgstr "" #. module: report_xlsx #: model:ir.model,name:report_xlsx.model_report_report_xlsx_partner_xlsx msgid "Partner XLSX Report" -msgstr "Rapport XLSX du partenaire" +msgstr "" #. module: report_xlsx #: model:ir.actions.report,name:report_xlsx.partner_xlsx @@ -37,12 +36,12 @@ msgstr "Imprimer en XLSX" #. module: report_xlsx #: model:ir.model,name:report_xlsx.model_ir_actions_report msgid "Report Action" -msgstr "Action rapport" +msgstr "" #. module: report_xlsx #: model:ir.model.fields,field_description:report_xlsx.field_ir_actions_report__report_type msgid "Report Type" -msgstr "Type de rapport" +msgstr "" #. module: report_xlsx #: model:ir.model.fields,help:report_xlsx.field_ir_actions_report__report_type @@ -52,15 +51,11 @@ msgid "" "browser PDF means the report will be rendered using Wkhtmltopdf and " "downloaded by the user." msgstr "" -"Type de rapport qui sera généré, chacun ayant sa propre méthode de " -"génération de rapports. HTML signifie que le rapport sera ouvert directement " -"dans votre navigateur PDF signifie que le rapport sera généré à l'aide de " -"Wkhtmltopdf et téléchargé par l'utilisateur." #. module: report_xlsx #: model:ir.model.fields.selection,name:report_xlsx.selection__ir_actions_report__report_type__xlsx msgid "XLSX" -msgstr "XLSX" +msgstr "" #, python-format #~ msgid "%s model was not found" diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/hr.po b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/hr.po index e573e87..8e6b990 100644 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/hr.po +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/hr.po @@ -16,8 +16,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "X-Generator: Weblate 4.14.1\n" #. module: report_xlsx diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/hr_HR.po b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/hr_HR.po index a991e6e..f9e99ee 100644 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/hr_HR.po +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/hr_HR.po @@ -17,8 +17,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" #. module: report_xlsx #: model:ir.model,name:report_xlsx.model_report_report_xlsx_abstract diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/it.po b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/it.po index 5d908b7..e2bd67b 100644 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/it.po +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/it.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-31 03:52+0000\n" -"PO-Revision-Date: 2024-01-18 09:34+0000\n" +"PO-Revision-Date: 2024-02-12 10:46+0000\n" "Last-Translator: mymage \n" "Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n" "Language: it\n" diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/report_xlsx.pot b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/report_xlsx.pot index d30bd50..739771e 100644 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/report_xlsx.pot +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/report_xlsx.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" +"Project-Id-Version: Odoo Server 19.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -19,13 +19,22 @@ msgid "Abstract XLSX Report" msgstr "" #. module: report_xlsx -#: model:ir.model,name:report_xlsx.model_report_report_xlsx_partner_xlsx -msgid "Partner XLSX Report" +#: model:ir.model.fields,field_description:report_xlsx.field_ir_actions_report__display_name +#: model:ir.model.fields,field_description:report_xlsx.field_report_report_xlsx_abstract__display_name +#: model:ir.model.fields,field_description:report_xlsx.field_report_report_xlsx_partner_xlsx__display_name +msgid "Display Name" msgstr "" #. module: report_xlsx -#: model:ir.actions.report,name:report_xlsx.partner_xlsx -msgid "Print to XLSX" +#: model:ir.model.fields,field_description:report_xlsx.field_ir_actions_report__id +#: model:ir.model.fields,field_description:report_xlsx.field_report_report_xlsx_abstract__id +#: model:ir.model.fields,field_description:report_xlsx.field_report_report_xlsx_partner_xlsx__id +msgid "ID" +msgstr "" + +#. module: report_xlsx +#: model:ir.model,name:report_xlsx.model_report_report_xlsx_partner_xlsx +msgid "Partner XLSX Report" msgstr "" #. module: report_xlsx diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/sv.po b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/sv.po index 9d7cbf4..058ed3d 100644 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/sv.po +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/sv.po @@ -6,20 +6,20 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2021-11-30 10:36+0000\n" -"Last-Translator: Simon S \n" +"PO-Revision-Date: 2024-06-12 08:55+0000\n" +"Last-Translator: jakobkrabbe \n" "Language-Team: none\n" "Language: sv\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3.2\n" +"X-Generator: Weblate 4.17\n" #. module: report_xlsx #: model:ir.model,name:report_xlsx.model_report_report_xlsx_abstract msgid "Abstract XLSX Report" -msgstr "" +msgstr "Abstrakt XLSX-rapport" #. module: report_xlsx #: model:ir.model,name:report_xlsx.model_report_report_xlsx_partner_xlsx diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/tr.po b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/tr.po index bb2cfe3..667034a 100644 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/tr.po +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/i18n/tr.po @@ -9,39 +9,40 @@ msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-31 03:52+0000\n" -"PO-Revision-Date: 2017-05-31 03:52+0000\n" -"Last-Translator: OCA Transbot , 2017\n" +"PO-Revision-Date: 2025-09-10 11:42+0000\n" +"Last-Translator: Tamer Sezgin \n" "Language-Team: Turkish (https://www.transifex.com/oca/teams/23907/tr/)\n" "Language: tr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Generator: Weblate 5.10.4\n" #. module: report_xlsx #: model:ir.model,name:report_xlsx.model_report_report_xlsx_abstract msgid "Abstract XLSX Report" -msgstr "" +msgstr "Temel XLSX Çıktısı" #. module: report_xlsx #: model:ir.model,name:report_xlsx.model_report_report_xlsx_partner_xlsx msgid "Partner XLSX Report" -msgstr "" +msgstr "İş Ortağı XLSX Raporu" #. module: report_xlsx #: model:ir.actions.report,name:report_xlsx.partner_xlsx msgid "Print to XLSX" -msgstr "" +msgstr "XLSX Yazdır" #. module: report_xlsx #: model:ir.model,name:report_xlsx.model_ir_actions_report msgid "Report Action" -msgstr "" +msgstr "Rapor Eylemi" #. module: report_xlsx #: model:ir.model.fields,field_description:report_xlsx.field_ir_actions_report__report_type msgid "Report Type" -msgstr "" +msgstr "Çıktı Türü" #. module: report_xlsx #: model:ir.model.fields,help:report_xlsx.field_ir_actions_report__report_type @@ -51,11 +52,15 @@ msgid "" "browser PDF means the report will be rendered using Wkhtmltopdf and " "downloaded by the user." msgstr "" +"Her biri kendi oluşturma yöntemine sahip olarak oluşturulacak raporun türü. " +"HTML, raporun doğrudan tarayıcınızda açılacağı anlamına gelir PDF, raporun " +"Wkhtmltopdf kullanılarak oluşturulacağı ve kullanıcı tarafından indirileceği " +"anlamına gelir." #. module: report_xlsx #: model:ir.model.fields.selection,name:report_xlsx.selection__ir_actions_report__report_type__xlsx msgid "XLSX" -msgstr "" +msgstr "XLSX" #, fuzzy #~ msgid "ir.actions.report" diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/models/ir_report.py b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/models/ir_report.py index 9d07d95..bf61546 100644 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/models/ir_report.py +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/models/ir_report.py @@ -19,14 +19,14 @@ class ReportAction(models.Model): @api.model def _render_xlsx(self, report_ref, docids, data): report_sudo = self._get_report(report_ref) - report_model_name = "report.%s" % report_sudo.report_name + report_model_name = f"report.{report_sudo.report_name}" report_model = self.env[report_model_name] ret = ( report_model.with_context(active_model=report_sudo.model) .sudo(False) .create_xlsx_report(docids, data) # noqa ) - if ret and isinstance(ret, (tuple, list)): # data, "xlsx" + if ret and isinstance(ret, (tuple | list)): # data, "xlsx" report_sudo.save_xlsx_report_attachment(docids, ret[0]) return ret diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/pyproject.toml b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/CONTRIBUTORS.md b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/CONTRIBUTORS.md new file mode 100644 index 0000000..db39b2e --- /dev/null +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/CONTRIBUTORS.md @@ -0,0 +1,11 @@ +- Adrien Peiffer \<\> +- Sébastien Alix \<\> +- Stéphane Bidoul \<\> +- Enric Tobella \<\> +- Graeme Gellatly \<\> +- Cristian Salamea \<\> +- Rod Schouteden \<\> +- Eugene Molotov \<\> +- Christopher Ormaza \<\> +- Houzéfa Abbasbhay \<\> +- Le Dinh Tien \<\> diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/CONTRIBUTORS.rst b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/CONTRIBUTORS.rst deleted file mode 100644 index 88b9d49..0000000 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,10 +0,0 @@ -* Adrien Peiffer -* Sébastien Alix -* Stéphane Bidoul -* Enric Tobella -* Graeme Gellatly -* Cristian Salamea -* Rod Schouteden -* Eugene Molotov -* Christopher Ormaza -* Houzéfa Abbasbhay diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/DESCRIPTION.rst b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/DESCRIPTION.md similarity index 100% rename from odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/DESCRIPTION.rst rename to odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/DESCRIPTION.md diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/INSTALL.md b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/INSTALL.md new file mode 100644 index 0000000..013e317 --- /dev/null +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/INSTALL.md @@ -0,0 +1,7 @@ +Make sure you have `xlsxwriter` Python module installed: + + $ pip3 install xlsxwriter + +For testing it is also necessary `xlrd` Python module installed: + + $ pip3 install xlrd diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/INSTALL.rst b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/INSTALL.rst deleted file mode 100644 index f75fbf2..0000000 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/INSTALL.rst +++ /dev/null @@ -1,7 +0,0 @@ -Make sure you have ``xlsxwriter`` Python module installed:: - -$ pip3 install xlsxwriter - -For testing it is also necessary ``xlrd`` Python module installed:: - -$ pip3 install xlrd diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/USAGE.rst b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/USAGE.md similarity index 80% rename from odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/USAGE.rst rename to odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/USAGE.md index 254ccc1..d869a5e 100644 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/USAGE.rst +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/readme/USAGE.md @@ -1,6 +1,7 @@ -An example of XLSX report for partners on a module called `module_name`: +An example of XLSX report for partners on a module called +\`module_name\`: -A python class :: +A python class : from odoo import models @@ -16,10 +17,10 @@ A python class :: bold = workbook.add_format({'bold': True}) sheet.write(0, 0, obj.name, bold) -To manipulate the ``workbook`` and ``sheet`` objects, refer to the -`documentation `_ of ``xlsxwriter``. +To manipulate the `workbook` and `sheet` objects, refer to the +[documentation](http://xlsxwriter.readthedocs.org/) of `xlsxwriter`. -A report XML record :: +A report XML record : Print to XLSX diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/report/report_abstract_xlsx.py b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/report/report_abstract_xlsx.py index 3e70aac..bbad65a 100644 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/report/report_abstract_xlsx.py +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/report/report_abstract_xlsx.py @@ -45,7 +45,7 @@ try: re.search(pattern, sheetname) and int(sheetname[-2:]) or 0 ) # Only up to 100 duplicates - deduplicated_secuence = "~{:02d}".format(duplicated_secuence + 1) + deduplicated_secuence = f"~{duplicated_secuence + 1:02d}" if duplicated_secuence > 99: raise xlsxwriter.exceptions.DuplicateWorksheetName # noqa: B904 if duplicated_secuence: @@ -95,7 +95,7 @@ class ReportXlsxAbstract(models.AbstractModel): """Get the format to be used in cells (symbol included). Used in account_financial_report addon""" s_before = currency.symbol if currency.position == "before" else "" - s_after = " %s" % currency.symbol if currency.position == "after" else "" + s_after = f" {currency.symbol}" if currency.position == "after" else "" return f"{f'{s_before}'}#,##0.{'0' * currency.decimal_places}{f'{s_after}'}" def create_xlsx_report(self, docids, data): diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/static/description/index.html b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/static/description/index.html index 4c0fc17..dc99cd5 100644 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/static/description/index.html +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/static/description/index.html @@ -3,7 +3,7 @@ -Base report xlsx +README.rst -
-

Base report xlsx

+
+ + +Odoo Community Association + +
+

Base report xlsx

-

Mature License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

+

Mature License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

This module provides a basic report class to generate xlsx report.

Table of contents

@@ -386,7 +391,7 @@ ul.auto-toc {
-

Installation

+

Installation

Make sure you have xlsxwriter Python module installed:

 $ pip3 install xlsxwriter
@@ -397,9 +402,10 @@ $ pip3 install xlrd
 
-

Usage

-

An example of XLSX report for partners on a module called module_name:

-

A python class

+

Usage

+

An example of XLSX report for partners on a module called +`module_name`:

+

A python class :

 from odoo import models
 
@@ -416,8 +422,9 @@ class PartnerXlsx(models.AbstractModel):
             sheet.write(0, 0, obj.name, bold)
 

To manipulate the workbook and sheet objects, refer to the -documentation of xlsxwriter.

-

A report XML record

+documentation of +xlsxwriter.

+

A report XML record :

 <record id="action_report_partner_xlsx" model="ir.actions.report">
     <field name="name">Print to XLSX</field>
@@ -432,24 +439,24 @@ class PartnerXlsx(models.AbstractModel):
 
-

Bug Tracker

+

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 to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • ACSONE SA/NV
  • Creu Blanca
-

Contributors

+

Contributors

+
diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/static/src/js/report/action_manager_report.esm.js b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/static/src/js/report/action_manager_report.esm.js index 9984801..dd85ed8 100644 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/static/src/js/report/action_manager_report.esm.js +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/static/src/js/report/action_manager_report.esm.js @@ -1,7 +1,6 @@ -/** @odoo-module **/ - import {download} from "@web/core/network/download"; import {registry} from "@web/core/registry"; +import {user} from "@web/core/user"; registry .category("ir.actions.report handlers") @@ -21,9 +20,7 @@ registry url += `/${actionContext.active_ids.join(",")}`; } if (type === "xlsx") { - const context = encodeURIComponent( - JSON.stringify(env.services.user.context) - ); + const context = encodeURIComponent(JSON.stringify(user.context)); url += `?context=${context}`; } } @@ -33,7 +30,7 @@ registry url: "/report/download", data: { data: JSON.stringify([url, action.report_type]), - context: JSON.stringify(env.services.user.context), + context: JSON.stringify(user.context), }, }); } finally { diff --git a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/tests/test_report.py b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/tests/test_report.py index af86ceb..cc75f26 100644 --- a/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/tests/test_report.py +++ b/odoo-bringout-oca-reporting-engine-report_xlsx/report_xlsx/tests/test_report.py @@ -1,6 +1,7 @@ # Copyright 2017 Creu Blanca # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +import io import logging from odoo.tests import common @@ -8,33 +9,41 @@ from odoo.tests import common _logger = logging.getLogger(__name__) try: - from xlrd import open_workbook + from openpyxl import load_workbook except ImportError: - _logger.debug("Can not import xlrd`.") + _logger.debug("Can not import openpyxl`.") class TestReport(common.TransactionCase): def setUp(self): super().setUp() self.report_object = self.env["ir.actions.report"] + vals = { + "name": "Print to XLSX", + "model": "res.partner", + "report_type": "xlsx", + "report_name": "report_xlsx.partner_xlsx", + "report_file": "res_partner", + } self.xlsx_report = self.env["report.report_xlsx.abstract"].with_context( active_model="res.partner" ) self.report_name = "report_xlsx.partner_xlsx" - self.report = self.report_object._get_report_from_name(self.report_name) + self.report = self.report_object.create(vals) self.docs = self.env["res.company"].search([], limit=1).partner_id def test_report(self): report = self.report self.assertEqual(report.report_type, "xlsx") - rep = self.report_object._render(self.report_name, self.docs.ids, {}) - wb = open_workbook(file_contents=rep[0]) - sheet = wb.sheet_by_index(0) - self.assertEqual(sheet.cell(0, 0).value, self.docs.name) + rep = self.report_object._render(self.report, self.docs.ids, {}) + file = io.BytesIO(rep[0]) + wb = load_workbook(file) + sheet = wb.active + self.assertEqual(sheet.cell(1, 1).value, self.docs.name) def test_save_attachment(self): self.report.attachment = 'object.name + ".xlsx"' - self.report_object._render(self.report_name, self.docs.ids, {}) + self.report_object._render(self.report, self.docs.ids, {}) attachment = self.env["ir.attachment"].search( [("res_id", "=", self.docs.id), ("res_model", "=", self.docs._name)] ) @@ -42,7 +51,6 @@ class TestReport(common.TransactionCase): self.assertEqual(attachment.name, f"{self.docs.name}.xlsx") def test_id_retrieval(self): - # Typical call from WebUI with wizard objs = self.xlsx_report._get_objs_for_report( False, {"context": {"active_ids": self.docs.ids}}