Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions report_xml/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
.. 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

===========
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 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.

Usage
=====

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 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.
* 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 make your custom report inherit ``report_xml.xsd_checked_report``, name
it like your XML ``<template>`` id prepended by ``report.``, add a ``xsd()``
method that returns a XSD in a string, and have XSD automatic checking for
free.

You can visit ``http://<server-address>/report/xml/<module.report_name>/<ids>``
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

Credits
=======

* Icon taken from http://commons.wikimedia.org/wiki/File:Text-xml.svg.

Contributors
------------

* Jairo Llopis <j.llopis@grupoesoc.es>
* Enric Tobella <etobella@creublanca.es>

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.


.. _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
.. _sample module: https://github.com/OCA/reporting-engine/tree/8.0/report_xml_sample
.. _lxml: http://lxml.de/
5 changes: 5 additions & 0 deletions report_xml/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import controllers
from . import models
25 changes: 25 additions & 0 deletions report_xml/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "XML Reports",
"version": "10.0.1.0.0",
"category": "Reporting",
"website": "https://github.com/OCA/reporting-engine",
"author": "Grupo ESOC Ingeniería de Servicios, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"application": False,
"summary": "Allow to generate XML reports",
"depends": [
"report",
],
"data": [
"views/report_xml_templates.xml",
],
"demo": [
"demo/report.xml",
]
}
4 changes: 4 additions & 0 deletions report_xml/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import main
26 changes: 26 additions & 0 deletions report_xml/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.addons.report.controllers import main as report
from odoo.http import route


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
21 changes: 21 additions & 0 deletions report_xml/demo/report.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>

<template id="demo_report_xml_view">
<t t-call="report_xml.utf8_header">
<root>
<user t-foreach="docs" t-as="doc">
<name t-esc="doc.name"/>
<vat t-esc="doc.vat"/>
</user>
</root>
</t>
</template>

<report id="demo_xml_report"
name="report_xml.demo_report_xml_view"
string="Demo xml report"
report_type="qweb-xml"
model="res.company"/>

</odoo>
43 changes: 43 additions & 0 deletions report_xml/i18n/am.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * report_xml
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: reporting-engine (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-15 19:59+0000\n"
"PO-Revision-Date: 2016-03-11 15:46+0000\n"
"Last-Translator: <>\n"
"Language-Team: Amharic (http://www.transifex.com/oca/OCA-reporting-engine-8-0/language/am/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: am\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#. module: report_xml
#: model:ir.model,name:report_xml.model_report_xml_xsd_checked_report
msgid "Base model for reports that need XSD checking"
msgstr ""

#. module: report_xml
#: field:report_xml.xsd_checked_report,display_name:0
msgid "Display Name"
msgstr ""

#. module: report_xml
#: field:report_xml.xsd_checked_report,id:0
msgid "ID"
msgstr "ID"

#. module: report_xml
#: field:report_xml.xsd_checked_report,__last_update:0
msgid "Last Modified on"
msgstr ""

#. module: report_xml
#: model:ir.model,name:report_xml.model_report
msgid "Report"
msgstr ""
43 changes: 43 additions & 0 deletions report_xml/i18n/ar.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * report_xml
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: reporting-engine (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-18 04:34+0000\n"
"PO-Revision-Date: 2016-03-11 15:46+0000\n"
"Last-Translator: <>\n"
"Language-Team: Arabic (http://www.transifex.com/oca/OCA-reporting-engine-8-0/language/ar/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: ar\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"

#. module: report_xml
#: model:ir.model,name:report_xml.model_report_xml_xsd_checked_report
msgid "Base model for reports that need XSD checking"
msgstr ""

#. module: report_xml
#: field:report_xml.xsd_checked_report,display_name:0
msgid "Display Name"
msgstr "اسم العرض"

#. module: report_xml
#: field:report_xml.xsd_checked_report,id:0
msgid "ID"
msgstr "المعرف"

#. module: report_xml
#: field:report_xml.xsd_checked_report,__last_update:0
msgid "Last Modified on"
msgstr "آخر تعديل في"

#. module: report_xml
#: model:ir.model,name:report_xml.model_report
msgid "Report"
msgstr ""
43 changes: 43 additions & 0 deletions report_xml/i18n/bg.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * report_xml
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: reporting-engine (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-18 04:34+0000\n"
"PO-Revision-Date: 2016-03-11 15:46+0000\n"
"Last-Translator: <>\n"
"Language-Team: Bulgarian (http://www.transifex.com/oca/OCA-reporting-engine-8-0/language/bg/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: bg\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: report_xml
#: model:ir.model,name:report_xml.model_report_xml_xsd_checked_report
msgid "Base model for reports that need XSD checking"
msgstr ""

#. module: report_xml
#: field:report_xml.xsd_checked_report,display_name:0
msgid "Display Name"
msgstr "Име за Показване"

#. module: report_xml
#: field:report_xml.xsd_checked_report,id:0
msgid "ID"
msgstr "ID"

#. module: report_xml
#: field:report_xml.xsd_checked_report,__last_update:0
msgid "Last Modified on"
msgstr "Последно обновено на"

#. module: report_xml
#: model:ir.model,name:report_xml.model_report
msgid "Report"
msgstr ""
43 changes: 43 additions & 0 deletions report_xml/i18n/bs.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * report_xml
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: reporting-engine (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-18 04:34+0000\n"
"PO-Revision-Date: 2016-03-11 15:46+0000\n"
"Last-Translator: <>\n"
"Language-Team: Bosnian (http://www.transifex.com/oca/OCA-reporting-engine-8-0/language/bs/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: bs\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_xml
#: model:ir.model,name:report_xml.model_report_xml_xsd_checked_report
msgid "Base model for reports that need XSD checking"
msgstr ""

#. module: report_xml
#: field:report_xml.xsd_checked_report,display_name:0
msgid "Display Name"
msgstr "Prikaži naziv"

#. module: report_xml
#: field:report_xml.xsd_checked_report,id:0
msgid "ID"
msgstr "ID"

#. module: report_xml
#: field:report_xml.xsd_checked_report,__last_update:0
msgid "Last Modified on"
msgstr "Zadnje mijenjano"

#. module: report_xml
#: model:ir.model,name:report_xml.model_report
msgid "Report"
msgstr ""
Loading