From bb8bb7305ddc0cafe67981e48c818d72b46a8250 Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Tue, 14 Apr 2026 09:37:13 +0200 Subject: [PATCH 1/2] [FIX] report_xml: Remove useless and faulty post init hook The post init hook created an ir attachment using content read as a string as value for the 'datas' field which expects a b64 encoded binary value.... This code comes from previous odoo version and should have been removed when migrating this addon --- report_xml/__init__.py | 1 - report_xml/__manifest__.py | 1 - report_xml/demo/report.xml | 5 ---- report_xml/hooks.py | 46 ----------------------------- report_xml/tests/test_report_xml.py | 4 +++ 5 files changed, 4 insertions(+), 53 deletions(-) delete mode 100644 report_xml/hooks.py diff --git a/report_xml/__init__.py b/report_xml/__init__.py index 64ad933661..853dc17d55 100644 --- a/report_xml/__init__.py +++ b/report_xml/__init__.py @@ -3,4 +3,3 @@ from . import controllers from . import models from . import reports -from .hooks import post_init_hook diff --git a/report_xml/__manifest__.py b/report_xml/__manifest__.py index a765efef36..745cc5e766 100644 --- a/report_xml/__manifest__.py +++ b/report_xml/__manifest__.py @@ -24,5 +24,4 @@ "demo/report.xml", # register report in the system "demo/demo_report.xml", # report body definition ], - "post_init_hook": "post_init_hook", } diff --git a/report_xml/demo/report.xml b/report_xml/demo/report.xml index c3e1374b5f..51c511e266 100644 --- a/report_xml/demo/report.xml +++ b/report_xml/demo/report.xml @@ -6,11 +6,6 @@ qweb-xml report_xml.demo_report_xml_view res_company - diff --git a/report_xml/hooks.py b/report_xml/hooks.py deleted file mode 100644 index c80a3c7a35..0000000000 --- a/report_xml/hooks.py +++ /dev/null @@ -1,46 +0,0 @@ -# License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html). - -import os - -from odoo import SUPERUSER_ID, api - - -def post_init_hook(cr, registry): - """ - Loaded after installing this module, and before the next module starts - installing. - - Add XSD Validation Schema for a demo report if it's in the system. - Demo data records are always created with `noupdate == True` and render of - tag `report` doesn't support new `ir.actions.report` field `xsd_schema`. - Thus it is impossible to define `xsd_schema` in the demo definition or add - schema after that via xml update record. Therefore it possible to add value - to `xsd_schema` field for demo record only via hook. - - Args: - * cr(odoo.sql_db.Cursor) - database cursor. - * registry(odoo.modules.registry.RegistryManager) - a mapping between - model names and model classes. - """ - env = api.Environment(cr, SUPERUSER_ID, {}) - report_domain = [ - ("report_name", "=", "report_xml.demo_report_xml_view") # report tech name - ] - demo_report = env["ir.actions.report"].search(report_domain, limit=1) - if demo_report: - dir_path = os.path.dirname(__file__) - xsd_file_relative_path = "demo/demo_report.xsd" - xsd_file_full_path = os.path.join(dir_path, xsd_file_relative_path) - - with open(xsd_file_full_path, "r") as xsd: - # `xsd_schema` is binary fields with an attribute - # `attachment=True` so XSD Schema will be added as attachment - attach_vals = { - "name": "Demo Report.xsd", - "datas": xsd.read(), - "res_model": "ir.actions.report", - "res_id": demo_report.id, - "res_field": "xsd_schema", - "type": "binary", - } - env["ir.attachment"].create(attach_vals) diff --git a/report_xml/tests/test_report_xml.py b/report_xml/tests/test_report_xml.py index b378991968..b89ac6cef3 100644 --- a/report_xml/tests/test_report_xml.py +++ b/report_xml/tests/test_report_xml.py @@ -10,6 +10,10 @@ class TestXmlReport(common.HttpCase): + def test_demo_loaded(self): + report = self.env.ref("report_xml.demo_xml_report") + self.assertTrue(report.xsd_schema) + def test_xml(self): report_object = self.env["ir.actions.report"] report_name = "report_xml.demo_report_xml_view" From 1cb0111de5a3bf19fe7de3b65c750bac0ca8a346 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 14 Apr 2026 19:01:30 +0000 Subject: [PATCH 2/2] [BOT] post-merge updates --- README.md | 2 +- report_xml/README.rst | 8 +++-- report_xml/__manifest__.py | 2 +- report_xml/static/description/index.html | 45 ++++++++++++++---------- 4 files changed, 35 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 6bb1256b19..4e81ae074a 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ addon | version | maintainers | summary [report_wkhtmltopdf_param](report_wkhtmltopdf_param/) | 16.0.1.0.0 | | Add new parameters for a paper format to be used by wkhtmltopdf command as arguments. [report_xlsx](report_xlsx/) | 16.0.2.0.2 | | Base module to create xlsx report [report_xlsx_helper](report_xlsx_helper/) | 16.0.1.0.0 | | Report xlsx helpers -[report_xml](report_xml/) | 16.0.1.1.2 | | Allow to generate XML reports +[report_xml](report_xml/) | 16.0.1.1.3 | | Allow to generate XML reports [sql_export](sql_export/) | 16.0.2.2.1 | legalsylvain florian-dacosta | Export data in csv file with SQL requests [sql_export_delta](sql_export_delta/) | 16.0.1.0.0 | hbrunn | Support exporting only the changes from last export [sql_export_excel](sql_export_excel/) | 16.0.1.0.1 | | Allow to export a sql query to an excel file. diff --git a/report_xml/README.rst b/report_xml/README.rst index 067ec0adba..2323a17d27 100644 --- a/report_xml/README.rst +++ b/report_xml/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 + =========== XML Reports =========== @@ -7,13 +11,13 @@ XML Reports !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:e491947bf3954fb138e5655b09ea354d544b745eb63f3cec1d51df4a900595c6 + !! source digest: sha256:b679be499dd034756b41af5fd17c161b212cc571469cddd9695d2ab420962155 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png :target: https://odoo-community.org/page/development-status :alt: Production/Stable -.. |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 diff --git a/report_xml/__manifest__.py b/report_xml/__manifest__.py index 745cc5e766..5c5cb5e144 100644 --- a/report_xml/__manifest__.py +++ b/report_xml/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html). { "name": "XML Reports", - "version": "16.0.1.1.2", + "version": "16.0.1.1.3", "category": "Reporting", "website": "https://github.com/OCA/reporting-engine", "development_status": "Production/Stable", diff --git a/report_xml/static/description/index.html b/report_xml/static/description/index.html index a0d137cefd..f030bf24f0 100644 --- a/report_xml/static/description/index.html +++ b/report_xml/static/description/index.html @@ -3,15 +3,16 @@ -XML Reports +README.rst -
-

XML Reports

+
+ + +Odoo Community Association + +
+

XML Reports

-

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

+

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

This module was written to extend the functionality of the reporting engine to support XML reports and allow modules to generate them by code or by QWeb templates.

@@ -391,7 +397,7 @@

XML Reports

-

Installation

+

Installation

To install this module, you need to:

  • Install lxml in Odoo’s $PYTHONPATH.
  • @@ -401,10 +407,10 @@

    Installation

    installed it’s probably because there is another module that depends on it.

-

Usage

+

Usage

This module is intended as a base engine for other modules to use it, so no direct result if you are a user.

-

If you are a developer

+

If you are a developer

To learn from an example, just check the demo report on GitHub for the model res.company or check it in interface from companies views.

To develop with this module, you need to:

@@ -435,7 +441,7 @@

If you are a developer

-

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 @@ -443,16 +449,16 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

  • Tecnativa
  • Avoin.Systems
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

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.

@@ -492,5 +500,6 @@

Maintainers

+