From 796027909c7f5148d8a7bc9943762e958eaec048 Mon Sep 17 00:00:00 2001 From: David Beal Date: Wed, 7 Oct 2015 22:04:48 +0200 Subject: [PATCH 001/123] =?UTF-8?q?[FIX]=C2=A0add=20arg=20to=20workbook=20?= =?UTF-8?q?creation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- report_xls/report_xls.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/report_xls/report_xls.py b/report_xls/report_xls.py index 4746b4b91a..f36f38a8d7 100644 --- a/report_xls/report_xls.py +++ b/report_xls/report_xls.py @@ -120,7 +120,9 @@ def create_source_xls(self, cr, uid, ids, data, context=None): parser_instance.set_context(objs, data, ids, 'xls') objs = parser_instance.localcontext['objects'] n = cStringIO.StringIO() - wb = xlwt.Workbook(encoding='utf-8') + # prevent style make error + # http://stackoverflow.com/questions/17130516/xlwt-set-style-making-error-more-than-4094-xfs-styles + wb = xlwt.Workbook(encoding='utf-8', style_compression=2) _p = AttrDict(parser_instance.localcontext) _xs = self.xls_styles self.xls_headers = { From 4cdf22a0fdaee71946664be18de13b7dd0e4c324 Mon Sep 17 00:00:00 2001 From: Nicola Malcontenti Date: Tue, 27 Oct 2015 14:53:06 +0100 Subject: [PATCH 002/123] [ADD] Add Module report_qweb_element_page_visibility --- .../README.rst | 77 ++++++++++++++++++ .../__init__.py | 20 +++++ .../__openerp__.py | 37 +++++++++ .../static/description/icon.png | Bin 0 -> 17479 bytes .../views/layouts.xml | 48 +++++++++++ 5 files changed, 182 insertions(+) create mode 100644 report_qweb_element_page_visibility/README.rst create mode 100644 report_qweb_element_page_visibility/__init__.py create mode 100644 report_qweb_element_page_visibility/__openerp__.py create mode 100644 report_qweb_element_page_visibility/static/description/icon.png create mode 100644 report_qweb_element_page_visibility/views/layouts.xml diff --git a/report_qweb_element_page_visibility/README.rst b/report_qweb_element_page_visibility/README.rst new file mode 100644 index 0000000000..4d8282daa5 --- /dev/null +++ b/report_qweb_element_page_visibility/README.rst @@ -0,0 +1,77 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +=================================== +Report Qweb Element Page Visibility +=================================== + +This module allows you to use 4 classes in QWEB reports: + +- not-first-page: shows element in every page but first +- not-last-page: shows element in every page but last +- first-page: shows element only on first page +- last-page: shows element only on last page + +Usage +===== + +To use this module, you need to: + +In the QWEB ``ir.ui.views`` used by your report, +you can add an element with css class with any of the classes described above. +For example if you need to improve invoice report header with +invoice's number in every page but first, and sale order report header +with order's name in every page but last, add this code to external_layout_header:: + + +
+ +
+
+ +
+ +
+
+ +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/143/8.0 + +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 `here `_. + + +Credits +======= + +Contributors +------------ + +* Nicola Malcontenti +* Lorenzo Battistini +* Alessio Gerace +* Alex Comba + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/report_qweb_element_page_visibility/__init__.py b/report_qweb_element_page_visibility/__init__.py new file mode 100644 index 0000000000..c3e52dcb1c --- /dev/null +++ b/report_qweb_element_page_visibility/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +######################################################################### +# # +# Copyright (C) 2015 Agile Business Group # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU Affero General Public License as # +# published by the Free Software Foundation, either version 3 of the # +# License, or (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU Affero General Public Licensefor more details. # +# # +# You should have received a copy of the # +# GNU Affero General Public License # +# along with this program. If not, see . # +# # +######################################################################### diff --git a/report_qweb_element_page_visibility/__openerp__.py b/report_qweb_element_page_visibility/__openerp__.py new file mode 100644 index 0000000000..b2316761cd --- /dev/null +++ b/report_qweb_element_page_visibility/__openerp__.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +######################################################################### +# # +# Copyright (C) 2015 Agile Business Group # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU Affero General Public License as # +# published by the Free Software Foundation, either version 3 of the # +# License, or (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU Affero General Public Licensefor more details. # +# # +# You should have received a copy of the # +# GNU Affero General Public License # +# along with this program. If not, see . # +# # +######################################################################### + +{ + 'name': 'Report Qweb Element Page Visibility', + 'version': '8.0.1.0.0', + 'author': 'Agile Business Group, Odoo Community Association (OCA)', + 'category': 'Tools', + "website": "https://odoo-community.org/", + "license": "AGPL-3", + "application": False, + "installable": True, + 'data': [ + 'views/layouts.xml', + ], + 'depends': [ + 'report', + ], +} diff --git a/report_qweb_element_page_visibility/static/description/icon.png b/report_qweb_element_page_visibility/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..4f946b5db1e82521a704e35b4cf8d9d28cf2d8a9 GIT binary patch literal 17479 zcmXtW-qS@RTZu&=*%J4A+;y>Lw@e z!_53;ZDh3b(R5u2uB!425Osn^C*Nn&cohEsKB~mEX6}&giwN!v| zz$4@Uv?(G3`l@?w*~zsWZ_fv*-dOw1=J7d`&%H*R~=`EE$> z{W3vI{oUWZ)P2eY(gLy(Diom!t&H}X7_t}3J+&5b07ekXY42-5FT68a8fo1tor;4k zo=?l`pTg3pD7)^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F3$hqyE-wMCiIPj|0|Gu$l!Iq_4*S5Y-Rnxg#dj9b1S)ssv z=7yR-RO8;)t4)3}`6h7PNm7W+mSb@{d2}Qkgr=W7RL=RO$@<1T*N#|-j%-Jn+_VEv@-iFcfTFDhrjkosJBAe`Q%-DrnIv1GK)=+ z`P+A{YxCURgJthP=2xgaH~k^KXix9;eS6OzSA-+P(%TB;vyIr^b4{O@w6 z$L|H-MpQricvd@*Z2KbxSpunHmU7EeWY~x&wB}nl2|;Z|Fw@SPH;{7IUvZ*#82)_jUExUBeb?xnTN$6lEHzpyI&*!6jw-GV7fEfJ-0_h0oM-J@_T z=F=>%fT=O1-@4QH$tlE@emlJ$G{qdNV5MqzpKa5dXRnn5+#h`R@d1XyvHmroo*6g( z-+VQ5tEhyM!QH4&@ro15XJ-7rcs*nf@ED4l-x}8C?f7-JxpexzUqPH2d=JV$>^|z^ zzFy$1==zD;8}8hCEt0Bw?i!OKQ@zL!j|a8;)Of1@)JLySZRGxY%M5tdhH8mxL`h0w zNvc(HQ7VvPFfuSS(KRsBH8Kk^u(UEYu`;&QH88a@Ft8NJG(gdio1c=IR*6M}1w_L; zt6LU84U!-mg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i + + + + + + + From 9e5cbd03f670d4b2d3b794ee4257c0d3c86152f7 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Mon, 1 Jun 2015 12:43:42 +0200 Subject: [PATCH 003/123] Add module report_xml. --- report_xml/README.rst | 82 + report_xml/__init__.py | 19 + report_xml/__openerp__.py | 32 + report_xml/controllers.py | 40 + report_xml/models.py | 70 + report_xml/static/description/icon.png | Bin 0 -> 4328 bytes report_xml/static/description/icon.svg | 3121 ++++++++++++++++++++++++ 7 files changed, 3364 insertions(+) create mode 100644 report_xml/README.rst create mode 100644 report_xml/__init__.py create mode 100644 report_xml/__openerp__.py create mode 100644 report_xml/controllers.py create mode 100644 report_xml/models.py create mode 100644 report_xml/static/description/icon.png create mode 100644 report_xml/static/description/icon.svg diff --git a/report_xml/README.rst b/report_xml/README.rst new file mode 100644 index 0000000000..0a3b88ab91 --- /dev/null +++ b/report_xml/README.rst @@ -0,0 +1,82 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +Qweb XML Reports +================ + +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. + +Installation +============ + +To install this module, you need to: + +* Install the repository `reporting-engine`_. + +Configuration +============= + +No manual configuration is needed. + +Usage +===== + +This module is technical, so its usage instructions are intended for module +developers. + +To use this module, you need to: + +* Create a module. +* Make it depend on this one. +* Follow `instructions to create reports`_ having in mind that the + ``report_type`` field in your ``ir.actions.report.xml`` record must be + ``qweb-xml``. + +In case you want to create a `custom report`_, the instructions remain the same +as for HTML reports, and the method that you must override is also called +``render_html``, even when this time you are creating a XML report. + +You can visit http:///report/xml// +to see your XML report online as a web page. + +For further information, please visit: + +* https://www.odoo.com/forum/help-1 +* https://github.com/OCA/reporting-engine + +Known issues / Roadmap +====================== + +None + +Credits +======= + +* Icon taken from http://commons.wikimedia.org/wiki/File:Text-xml.svg. + +Contributors +------------ + +* Jairo Llopis + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit http://odoo-community.org. + + +.. _reporting-engine: https://github.com/OCA/reporting-engine +.. _instructions to create reports: https://www.odoo.com/documentation/8.0/reference/reports.html +.. _custom report: https://www.odoo.com/documentation/8.0/reference/reports.html#custom-reports diff --git a/report_xml/__init__.py b/report_xml/__init__.py new file mode 100644 index 0000000000..809441f63d --- /dev/null +++ b/report_xml/__init__.py @@ -0,0 +1,19 @@ +# -*- encoding: utf-8 -*- + +# Odoo, Open Source Management Solution +# Copyright (C) 2014-2015 Grupo ESOC +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +from . import controllers, models diff --git a/report_xml/__openerp__.py b/report_xml/__openerp__.py new file mode 100644 index 0000000000..ed9a6eeb2d --- /dev/null +++ b/report_xml/__openerp__.py @@ -0,0 +1,32 @@ +# -*- encoding: utf-8 -*- + +# Odoo, Open Source Management Solution +# Copyright (C) 2014-2015 Grupo ESOC +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +{ + "name": "Qweb XML Reports", + "version": "1.0", + "category": "Reporting", + "author": "Odoo Community Association (OCA), Grupo ESOC", + "license": "AGPL-3", + "website": "https://odoo-community.org/", + "installable": True, + "application": False, + "summary": "Allow to generate XML reports", + "depends": [ + "report", + ], +} diff --git a/report_xml/controllers.py b/report_xml/controllers.py new file mode 100644 index 0000000000..a8ffb04f90 --- /dev/null +++ b/report_xml/controllers.py @@ -0,0 +1,40 @@ +# -*- encoding: utf-8 -*- + +# Odoo, Open Source Management Solution +# Copyright (C) 2014-2015 Grupo ESOC +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +from openerp.http import route +from openerp.addons.report.controllers import main as report + + +class ReportController(report.ReportController): + @route() + def report_routes(self, reportname, docids=None, converter=None, **data): + # Trick the main reporter to think we want an HTML report + new_converter = converter if converter != "xml" else "html" + response = super(ReportController, self).report_routes( + reportname, docids, new_converter, **data) + + # If it was an XML report, just download the generated response + if converter == "xml": + # XML header must be before any spaces, and it is a common error, + # so let's fix that here and make developers happier + response.data = response.data.strip() + + # XML files should be downloaded + response.headers.set("Content-Type", "text/xml") + + return response diff --git a/report_xml/models.py b/report_xml/models.py new file mode 100644 index 0000000000..168e4de920 --- /dev/null +++ b/report_xml/models.py @@ -0,0 +1,70 @@ +# -*- encoding: utf-8 -*- + +# Odoo, Open Source Management Solution +# Copyright (C) 2014-2015 Grupo ESOC +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +from openerp import api, fields, models + + +class ReportAction(models.Model): + _inherit = "ir.actions.report.xml" + + report_type = fields.Selection(selection_add=[("qweb-xml", "XML")]) + + def _lookup_report(self, cr, name): + """Enable ``qweb-xml`` report lookup.""" + try: + super(ReportAction, self)._lookup_report(cr, name) + except Exception as ex: + # Somebody thought it was a good idea to use standard exceptions + if "qweb-xml" not in ex.message: + raise ex + else: + cr.execute( + "SELECT * FROM ir_act_report_xml WHERE report_name=%s", + (name,)) + return cr.dictfetchone()["report_name"] + + @api.model + def render_report(self, res_ids, name, data): + """Special handling for ``qweb-xml`` reports.""" + if data.get("report_type") == u"qweb-xml": + new_report = self._lookup_report(name) + recs = self.env[self.env.context["active_model"]].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JNGBP zCs@@>j3`b%vCSM?)e@#K6n75|Jzz^`f0?j3^#M8uyX+&rp7=`HG=Lc=Xfe}siA84+ zPX}lI*9}5^ce*7hnIGzO&g2_vGy54=!>+farnWZqIwmaE{5yLOk3NLU-!-=D?7rt( z)^TT9#@i!W;#WKGr+-$Gi-OHc0!QkGYXR{e&gz<%-ajH|`4#V`RaYw|UQ;tWXk}#O zs|xUeex7oXd{#ZncP$6MSnF=+BT7hK z{W?n7^f%`v+P6L^h;K4+W<@e3q1iK5eU(7_Z@wCI+lVe + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + July 2009 + + + Franziska Sponsel + + + + + Franziska Sponsel + + + + + RRZE + + + + + export + csv + text + + + + + Hendrik Eggers, Beate Kaspar + + + uses <http://ftp.uni-erlangen.de/pub/rrze/tango/rrze-icon-set/tango/scalable/emblems/report.svg> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 43e8ad297c1ee9bb5313f44bc5f04e809870c0d7 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 12 Jun 2015 11:09:09 +0200 Subject: [PATCH 004/123] Add template utf8_header. Almost any XML must start with this. Let's make it easier. --- report_xml/__openerp__.py | 3 +++ report_xml/views/report_xml_templates.xml | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 report_xml/views/report_xml_templates.xml diff --git a/report_xml/__openerp__.py b/report_xml/__openerp__.py index ed9a6eeb2d..e2f73bee10 100644 --- a/report_xml/__openerp__.py +++ b/report_xml/__openerp__.py @@ -29,4 +29,7 @@ "depends": [ "report", ], + "data": [ + "views/report_xml_templates.xml", + ] } diff --git a/report_xml/views/report_xml_templates.xml b/report_xml/views/report_xml_templates.xml new file mode 100644 index 0000000000..8a7c88abc7 --- /dev/null +++ b/report_xml/views/report_xml_templates.xml @@ -0,0 +1,13 @@ + + + + + + + + From 357d37dae038b4ac35254075b4f4e88c33449817 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 12 Jun 2015 11:10:00 +0200 Subject: [PATCH 005/123] Easier XSD checking reports. Any report inheriting this AbstractModel can check its XML results against any XSD. --- report_xml/README.rst | 2 ++ report_xml/models.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/report_xml/README.rst b/report_xml/README.rst index 0a3b88ab91..b0969641fa 100644 --- a/report_xml/README.rst +++ b/report_xml/README.rst @@ -13,6 +13,7 @@ Installation To install this module, you need to: +* Install lxml_ in Odoo's ``$PYTHONPATH``. * Install the repository `reporting-engine`_. Configuration @@ -80,3 +81,4 @@ To contribute to this module, please visit http://odoo-community.org. .. _reporting-engine: https://github.com/OCA/reporting-engine .. _instructions to create reports: https://www.odoo.com/documentation/8.0/reference/reports.html .. _custom report: https://www.odoo.com/documentation/8.0/reference/reports.html#custom-reports +.. _lxml: http://lxml.de/ diff --git a/report_xml/models.py b/report_xml/models.py index 168e4de920..47e1b87433 100644 --- a/report_xml/models.py +++ b/report_xml/models.py @@ -16,6 +16,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from lxml import etree from openerp import api, fields, models @@ -68,3 +69,33 @@ def _get_report_from_name(self, report_name): return self.env["ir.actions.report.xml"].search( [("report_type", "=", "qweb-xml"), ("report_name", "=", report_name)])[0] + + +class XSDCheckedReport(models.AbstractModel): + """Check XML report against a XSD schema before downloading it. + + This is an Abstract Model to be inherited by the real report models, which + must implement :meth:`.xsd` and have a ``_name`` in the form + ``report..``. + """ + _name = "report_xml.xsd_checked_report" + _description = "Base model for reports that need XSD checking" + + @api.multi + def xsd(self): + """Return the XSD schema contents.""" + raise NotImplementedError + + @api.multi + def render_html(self, data=None): + """Return the XML report after checking it against an XSD.""" + docargs = {"docs": (self.env[self.env.context["active_model"]] + .browse(self.env.context["active_ids"]))} + xsd = etree.XMLSchema(etree.XML(self.xsd())) + parser = etree.XMLParser(schema=xsd) + result = (self.env["report"] + .render(self._name[len("report."):], docargs) + .strip()) + etree.fromstring(result, parser) + + return result From ae447728babfb475ff565af91217234574371bc3 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 12 Jun 2015 11:15:17 +0200 Subject: [PATCH 006/123] Add sample module. --- report_xml/README.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/report_xml/README.rst b/report_xml/README.rst index b0969641fa..e8d2b38046 100644 --- a/report_xml/README.rst +++ b/report_xml/README.rst @@ -42,6 +42,9 @@ as for HTML reports, and the method that you must override is also called You can visit http:///report/xml// to see your XML report online as a web page. +If you are a developer and you want a sample module to know how to use this +reporting engine, you can review `l10n_es_training`_. + For further information, please visit: * https://www.odoo.com/forum/help-1 @@ -81,4 +84,5 @@ To contribute to this module, please visit http://odoo-community.org. .. _reporting-engine: https://github.com/OCA/reporting-engine .. _instructions to create reports: https://www.odoo.com/documentation/8.0/reference/reports.html .. _custom report: https://www.odoo.com/documentation/8.0/reference/reports.html#custom-reports +.. _l10n_es_training: https://github.com/grupoesoc/l10n-spain/tree/l10n_es_training/l10n_es_training .. _lxml: http://lxml.de/ From fe6f0cc213573dc331617fb5e1c9a9c59ae4183f Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 12 Jun 2015 11:15:28 +0200 Subject: [PATCH 007/123] Sort links. --- report_xml/README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/report_xml/README.rst b/report_xml/README.rst index e8d2b38046..6849c1e2f9 100644 --- a/report_xml/README.rst +++ b/report_xml/README.rst @@ -81,8 +81,8 @@ promote its widespread use. To contribute to this module, please visit http://odoo-community.org. -.. _reporting-engine: https://github.com/OCA/reporting-engine -.. _instructions to create reports: https://www.odoo.com/documentation/8.0/reference/reports.html .. _custom report: https://www.odoo.com/documentation/8.0/reference/reports.html#custom-reports +.. _instructions to create reports: https://www.odoo.com/documentation/8.0/reference/reports.html +.. _reporting-engine: https://github.com/OCA/reporting-engine .. _l10n_es_training: https://github.com/grupoesoc/l10n-spain/tree/l10n_es_training/l10n_es_training .. _lxml: http://lxml.de/ From 40adb5bbc76d642a4ec7bea0a30684a66350b56a Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 12 Jun 2015 11:39:14 +0200 Subject: [PATCH 008/123] Fix XML tag mismatch. --- report_xml/views/report_xml_templates.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/report_xml/views/report_xml_templates.xml b/report_xml/views/report_xml_templates.xml index 8a7c88abc7..facfc32880 100644 --- a/report_xml/views/report_xml_templates.xml +++ b/report_xml/views/report_xml_templates.xml @@ -9,5 +9,5 @@ - + From 93506ece59b445123057bba4ea5db4bfd3403b82 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Mon, 15 Jun 2015 11:49:43 +0200 Subject: [PATCH 009/123] Allow docargs to be loaded from context. --- report_xml/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/report_xml/models.py b/report_xml/models.py index 47e1b87433..498346ad7f 100644 --- a/report_xml/models.py +++ b/report_xml/models.py @@ -89,8 +89,9 @@ def xsd(self): @api.multi def render_html(self, data=None): """Return the XML report after checking it against an XSD.""" - docargs = {"docs": (self.env[self.env.context["active_model"]] - .browse(self.env.context["active_ids"]))} + docargs = self.env.context.get("docargs", dict()) + docargs["docs"] = (self.env[self.env.context["active_model"]] + .browse(self.env.context["active_ids"])) xsd = etree.XMLSchema(etree.XML(self.xsd())) parser = etree.XMLParser(schema=xsd) result = (self.env["report"] From 2c2cf1904ca62dea27a360ec8cf1d2d0fa3588ff Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Mon, 15 Jun 2015 12:35:39 +0200 Subject: [PATCH 010/123] Only replace the docs key if it is missing. --- report_xml/models.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/report_xml/models.py b/report_xml/models.py index 498346ad7f..c82342389c 100644 --- a/report_xml/models.py +++ b/report_xml/models.py @@ -88,11 +88,16 @@ def xsd(self): @api.multi def render_html(self, data=None): - """Return the XML report after checking it against an XSD.""" + """Return the XML report after checking it against an XSD. + + If ``context`` contains a dict called ``docargs``, it will be used as + the Qweb context. The special key ``docs`` will be added to ``docargs`` + automatically if missing. docargs = self.env.context.get("docargs", dict()) - docargs["docs"] = (self.env[self.env.context["active_model"]] - .browse(self.env.context["active_ids"])) xsd = etree.XMLSchema(etree.XML(self.xsd())) + if "docs" not in docargs: + docargs["docs"] = (self.env[self.env.context["active_model"]] + .browse(self.env.context["active_ids"])) parser = etree.XMLParser(schema=xsd) result = (self.env["report"] .render(self._name[len("report."):], docargs) From 3d5a0cb68da18657187b46b94d80b9d5186793bf Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Mon, 15 Jun 2015 12:36:01 +0200 Subject: [PATCH 011/123] Clearer code comments, add logging. --- report_xml/models.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/report_xml/models.py b/report_xml/models.py index c82342389c..c83017a7a5 100644 --- a/report_xml/models.py +++ b/report_xml/models.py @@ -16,10 +16,14 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +import logging from lxml import etree from openerp import api, fields, models +_logger = logging.getLogger(__name__) + + class ReportAction(models.Model): _inherit = "ir.actions.report.xml" @@ -93,15 +97,29 @@ def render_html(self, data=None): If ``context`` contains a dict called ``docargs``, it will be used as the Qweb context. The special key ``docs`` will be added to ``docargs`` automatically if missing. + """ + # Qweb context docargs = self.env.context.get("docargs", dict()) - xsd = etree.XMLSchema(etree.XML(self.xsd())) if "docs" not in docargs: docargs["docs"] = (self.env[self.env.context["active_model"]] .browse(self.env.context["active_ids"])) + + # Load XSD + xsd = etree.XML(self.xsd()) + _logger.debug("XSD schema contents: %s", etree.tostring(xsd)) + xsd = etree.XMLSchema(xsd) parser = etree.XMLParser(schema=xsd) + + # Generate XML report result = (self.env["report"] .render(self._name[len("report."):], docargs) .strip()) - etree.fromstring(result, parser) + + # Validate XML with XSD + try: + etree.fromstring(result, parser) + except Exception as error: + _logger.error(result) + raise error return result From 6e15df4ae1a7f203231193c6b209f331120caf6b Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Wed, 17 Jun 2015 11:03:40 +0200 Subject: [PATCH 012/123] Oops, this header belongs to other module. --- report_xml/views/report_xml_templates.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/report_xml/views/report_xml_templates.xml b/report_xml/views/report_xml_templates.xml index facfc32880..811eddec55 100644 --- a/report_xml/views/report_xml_templates.xml +++ b/report_xml/views/report_xml_templates.xml @@ -4,9 +4,7 @@ From 8c53e967efbb6899b44dedf4b9a3d40ca33a5aa0 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Wed, 17 Jun 2015 11:09:52 +0200 Subject: [PATCH 013/123] Add module report_xml_sample. --- report_xml/README.rst | 29 +- report_xml_sample/README.rst | 69 + report_xml_sample/__init__.py | 19 + report_xml_sample/__openerp__.py | 36 + report_xml_sample/models.py | 39 + report_xml_sample/static/description/icon.png | Bin 0 -> 6825 bytes report_xml_sample/static/description/icon.svg | 3131 +++++++++++++++++ .../views/res_partner_templates.xml | 43 + report_xml_sample/xsd/sample_report.xsd | 22 + 9 files changed, 3380 insertions(+), 8 deletions(-) create mode 100644 report_xml_sample/README.rst create mode 100644 report_xml_sample/__init__.py create mode 100644 report_xml_sample/__openerp__.py create mode 100644 report_xml_sample/models.py create mode 100644 report_xml_sample/static/description/icon.png create mode 100644 report_xml_sample/static/description/icon.svg create mode 100644 report_xml_sample/views/res_partner_templates.xml create mode 100644 report_xml_sample/xsd/sample_report.xsd diff --git a/report_xml/README.rst b/report_xml/README.rst index 6849c1e2f9..564bedf315 100644 --- a/report_xml/README.rst +++ b/report_xml/README.rst @@ -16,6 +16,9 @@ To install this module, you need to: * Install lxml_ in Odoo's ``$PYTHONPATH``. * Install the repository `reporting-engine`_. +But this module does nothing for the end user by itself, so if you have it +installed it's probably because there is another module that depends on it. + Configuration ============= @@ -24,10 +27,18 @@ No manual configuration is needed. Usage ===== -This module is technical, so its usage instructions are intended for module -developers. +If you are a user +----------------- + +You will be able to download XML reports from the *Print* menu found on form +and list views. + +If you are a developer +---------------------- -To use this module, you need to: +To learn from an example, just check the `sample module`_. + +To develop with this module, you need to: * Create a module. * Make it depend on this one. @@ -39,11 +50,13 @@ In case you want to create a `custom report`_, the instructions remain the same as for HTML reports, and the method that you must override is also called ``render_html``, even when this time you are creating a XML report. -You can visit http:///report/xml// -to see your XML report online as a web page. +You can make your custom report inherit ``report_xml.xsd_checked_report``, name +it like your XML ``