Jairo Llopis
10 years ago
9 changed files with 3380 additions and 8 deletions
-
29report_xml/README.rst
-
69report_xml_sample/README.rst
-
19report_xml_sample/__init__.py
-
36report_xml_sample/__openerp__.py
-
39report_xml_sample/models.py
-
BINreport_xml_sample/static/description/icon.png
-
3131report_xml_sample/static/description/icon.svg
-
43report_xml_sample/views/res_partner_templates.xml
-
22report_xml_sample/xsd/sample_report.xsd
@ -0,0 +1,69 @@ |
|||||
|
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
||||
|
:alt: License: AGPL-3 |
||||
|
|
||||
|
Qweb XML Reports Sample Module |
||||
|
============================== |
||||
|
|
||||
|
This module was written to serve as a sample for developers that want to |
||||
|
generate Qweb XML reports in their modules. It is useless for the final user. |
||||
|
|
||||
|
Installation |
||||
|
============ |
||||
|
|
||||
|
To install this module, you need to: |
||||
|
|
||||
|
* Install lxml_ in Odoo's ``$PYTHONPATH``. |
||||
|
* Install the repository `reporting-engine`_. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
|
||||
|
No manual configuration is needed. |
||||
|
|
||||
|
Usage |
||||
|
===== |
||||
|
|
||||
|
Go to *Messaging > Organizer > Contacts*, enter any partner (or switch to *list |
||||
|
view* and select one or more of them), and under the *Print* menu download any |
||||
|
of the XML sample reports. |
||||
|
|
||||
|
For further information, please visit: |
||||
|
|
||||
|
* https://www.odoo.com/documentation/8.0/reference/qweb.html |
||||
|
* https://www.odoo.com/documentation/8.0/reference/reports.html |
||||
|
* 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 <j.llopis@grupoesoc.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. |
||||
|
|
||||
|
|
||||
|
.. _reporting-engine: https://github.com/OCA/reporting-engine |
||||
|
.. _lxml: http://lxml.de/ |
@ -0,0 +1,19 @@ |
|||||
|
# -*- encoding: utf-8 -*- |
||||
|
|
||||
|
# Odoo, Open Source Management Solution |
||||
|
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es> |
||||
|
# |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
|
||||
|
from . import models |
@ -0,0 +1,36 @@ |
|||||
|
# -*- encoding: utf-8 -*- |
||||
|
|
||||
|
# Odoo, Open Source Management Solution |
||||
|
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es> |
||||
|
# |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
|
||||
|
{ |
||||
|
"name": "Qweb XML Sample Report", |
||||
|
"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": "For developers who want an example", |
||||
|
"depends": [ |
||||
|
"contacts", |
||||
|
"report", |
||||
|
], |
||||
|
"data": [ |
||||
|
"views/res_partner_templates.xml", |
||||
|
] |
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
# -*- encoding: utf-8 -*- |
||||
|
|
||||
|
# Odoo, Open Source Management Solution |
||||
|
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es> |
||||
|
# |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
|
||||
|
from os import path |
||||
|
from openerp import api, models |
||||
|
|
||||
|
|
||||
|
class XSDSampleReport(models.AbstractModel): |
||||
|
"""This report is checked against an XSD before downloading. |
||||
|
|
||||
|
The XML itself is declared in ``./views/res_partner_templates.xml``, and |
||||
|
the XSD can be found in ``./xsd/sample_report.xsd``. |
||||
|
|
||||
|
This model's :attr:`._name` must be ``report.<XML ID of template>``. |
||||
|
""" |
||||
|
_name = "report.report_xml_sample.xsd_sample_report" |
||||
|
_inherit = "report_xml.xsd_checked_report" |
||||
|
|
||||
|
@api.multi |
||||
|
def xsd(self): |
||||
|
"""Return the XSD schema contents.""" |
||||
|
file = path.join(path.dirname(__file__), "xsd", "sample_report.xsd") |
||||
|
with open(file) as xsd: |
||||
|
return xsd.read() |
After Width: 100 | Height: 100 | Size: 6.7 KiB |
3131
report_xml_sample/static/description/icon.svg
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,43 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<openerp> |
||||
|
<data> |
||||
|
|
||||
|
<!-- Basic XML report --> |
||||
|
<report |
||||
|
id="sample_report_action" |
||||
|
name="report_xml_sample.sample_report" |
||||
|
string="XML Report Sample" |
||||
|
report_type="qweb-xml" |
||||
|
model="res.partner"/> |
||||
|
|
||||
|
<template id="sample_report"> |
||||
|
<t t-call="report_xml.utf8_header"> |
||||
|
<partners> |
||||
|
<partner t-foreach="docs" t-as="p"> |
||||
|
<id t-esc="p.id"/> |
||||
|
<name t-esc="p.name"/> |
||||
|
<children t-if="p.child_ids"> |
||||
|
<partner t-foreach="p.child_ids" t-as="c"> |
||||
|
<id t-esc="c.id"/> |
||||
|
<name t-esc="c.name"/> |
||||
|
</partner> |
||||
|
</children> |
||||
|
</partner> |
||||
|
</partners> |
||||
|
</t> |
||||
|
</template> |
||||
|
|
||||
|
<!-- Report checked against an XSD (see also ``../models.py``) --> |
||||
|
<report |
||||
|
id="xsd_sample_report_action" |
||||
|
name="report_xml_sample.xsd_sample_report" |
||||
|
string="XSD-Checked XML Report Sample" |
||||
|
report_type="qweb-xml" |
||||
|
model="res.partner"/> |
||||
|
|
||||
|
<template id="xsd_sample_report"> |
||||
|
<t t-call="report_xml_sample.sample_report"/> |
||||
|
</template> |
||||
|
|
||||
|
</data> |
||||
|
</openerp> |
@ -0,0 +1,22 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
||||
|
<!-- Complex types --> |
||||
|
<xs:complexType name="t_partners"> |
||||
|
<xs:sequence> |
||||
|
<xs:element name="partner" |
||||
|
type="t_partner" |
||||
|
minOccurs="0" |
||||
|
maxOccurs="unbounded"/> |
||||
|
</xs:sequence> |
||||
|
</xs:complexType> |
||||
|
<xs:complexType name="t_partner"> |
||||
|
<xs:sequence> |
||||
|
<xs:element name="id" type="xs:int"/> |
||||
|
<xs:element name="name" type="xs:string"/> |
||||
|
<xs:element name="children" type="t_partners" minOccurs="0"/> |
||||
|
</xs:sequence> |
||||
|
</xs:complexType> |
||||
|
|
||||
|
<!-- Schema --> |
||||
|
<xs:element name="partners" type="t_partners"/> |
||||
|
</xs:schema> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue