diff --git a/report_xml/README.rst b/report_xml/README.rst index de39760f..4caccd0a 100644 --- a/report_xml/README.rst +++ b/report_xml/README.rst @@ -120,6 +120,7 @@ Contributors * Jairo Llopis * `Avoin.Systems `_: * Tatiana Deribina +* Iván Antón Other credits ~~~~~~~~~~~~~ diff --git a/report_xml/__manifest__.py b/report_xml/__manifest__.py index ba8344aa..9c56fd45 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": "13.0.1.0.0", + "version": "14.0.1.0.0", "category": "Reporting", "website": "https://github.com/OCA/reporting-engine", "author": "Tecnativa, Odoo Community Association (OCA), Avoin.Systems", diff --git a/report_xml/controllers/main.py b/report_xml/controllers/main.py index f7c64666..d4ea1432 100644 --- a/report_xml/controllers/main.py +++ b/report_xml/controllers/main.py @@ -2,7 +2,6 @@ # License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html). import json -import time from werkzeug.urls import url_decode @@ -32,7 +31,7 @@ class ReportController(report.ReportController): del data["context"]["lang"] context.update(data["context"]) - xml = report.with_context(context).render_qweb_xml(docids, data=data)[0] + xml = report.with_context(context)._render_qweb_xml(docids, data=data)[0] xmlhttpheaders = [ ("Content-Type", "text/xml"), ("Content-Length", len(xml)), @@ -75,7 +74,7 @@ class ReportController(report.ReportController): records = request.env[report.model].browse(ids) if report.print_report_name and not len(records) > 1: report_name = safe_eval( - report.print_report_name, {"object": records, "time": time} + report.print_report_name, {"object": records} ) filename = "{}.xml".format(report_name) response.headers.add( diff --git a/report_xml/demo/report.xml b/report_xml/demo/report.xml index 67acbf1c..c3e1374b 100644 --- a/report_xml/demo/report.xml +++ b/report_xml/demo/report.xml @@ -1,19 +1,16 @@ - - - + --> diff --git a/report_xml/models/ir_actions_report.py b/report_xml/models/ir_actions_report.py index 56e125d6..2fb8ec5d 100644 --- a/report_xml/models/ir_actions_report.py +++ b/report_xml/models/ir_actions_report.py @@ -7,7 +7,9 @@ from odoo import fields, models class IrActionsReport(models.Model): _inherit = "ir.actions.report" - report_type = fields.Selection(selection_add=[("qweb-xml", "XML")]) + report_type = fields.Selection( + selection_add=[("qweb-xml", "XML")], ondelete={"qweb-xml": "set default"} + ) xsd_schema = fields.Binary( string="XSD Validation Schema", attachment=True, @@ -34,7 +36,7 @@ class IrActionsReport(models.Model): ), ) - def render_qweb_xml(self, docids, data=None): + def _render_qweb_xml(self, docids, data=None): """ Call `generate_report` method of report abstract class `report.` or of standard class for XML report diff --git a/report_xml/readme/CONTRIBUTORS.rst b/report_xml/readme/CONTRIBUTORS.rst index 12497944..6a3fdad2 100644 --- a/report_xml/readme/CONTRIBUTORS.rst +++ b/report_xml/readme/CONTRIBUTORS.rst @@ -3,3 +3,4 @@ * Jairo Llopis * `Avoin.Systems `_: * Tatiana Deribina +* Iván Antón diff --git a/report_xml/reports/report_report_xml_abstract.py b/report_xml/reports/report_report_xml_abstract.py index b3fd291d..bb3f2e35 100644 --- a/report_xml/reports/report_report_xml_abstract.py +++ b/report_xml/reports/report_report_xml_abstract.py @@ -51,7 +51,7 @@ class ReportXmlAbstract(models.AbstractModel): data = ir_report._get_rendering_context(docids, data) # render template - result_bin = ir_report.render_template(ir_report.report_name, data) + result_bin = ir_report._render_template(ir_report.report_name, data) # prettify result content # normalize indents diff --git a/report_xml/tests/test_report_xml.py b/report_xml/tests/test_report_xml.py index 365b1e7e..b92ed921 100644 --- a/report_xml/tests/test_report_xml.py +++ b/report_xml/tests/test_report_xml.py @@ -13,7 +13,7 @@ class TestXmlReport(common.TransactionCase): report = report_object._get_report_from_name(report_name) docs = self.env["res.company"].search([], limit=1) self.assertEqual(report.report_type, "qweb-xml") - result_report = report.render(docs.ids, {}) + result_report = report._render(docs.ids, {}) result_tree = etree.fromstring(result_report[0]) el = result_tree.xpath("/root/user/name") self.assertEqual(el[0].text, docs.ensure_one().name)