Create Tryton reports based on jinja2 python library
Project description
Jinja Reports module
jinja_reports is a jinja2 extension developed to work with Tryton ERP. We can create our own reports based on jinja2 with html templates.
How does it work?
Steps to use Jinja Reports:
- Inherit the base Jinja2Report class.
- Define the meta model name.
- Create an html template.
- Create an action report pointing to template path and model name.
Example
Here's a an example of a report which contains three files.
- Python class that must be registered to the Tryton Pool.
from trytond.modules.jinja_report.report import Jinja2Report
from trytond.pool import Pool
class MyReport(Jinja2Report):
__name__ = 'my_module.my_report'
def register():
Pool.register(MyReport, module='your_module', type_='report')
- The html template of your report
<html>
<body>
{% for record in records %}
{{ record.name }}
{% endfor %}
{{ data.get('some_data') }}
</body>
</html>
- The action report registered as xml:
<record model="ir.action.report" id="my_report_action">
<field name="name">Title of my report</field>
<field name="report">path/to/my/report.html</field>
<field name="report_name">my_module.my_report</field>
<field name="model">party.party</field>
<field name="extension">pdf</field>
<field name="template_extension">html</field>
</record>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for trytoncalidae_jinja_report-7.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a7f58ddeaccc6dddf7091d88a46cb600edef395aeb66ed89e2f9fb92edd6882 |
|
MD5 | 7dac431ea73b922f1f2160223e0c022e |
|
BLAKE2b-256 | 943ec731179efd834a45853aa4792584a3d7d6f707cee46cb876b62a9d8128f5 |
Close
Hashes for trytoncalidae_jinja_report-7.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0cab41c4b709bc99a50c7e859845b8aeb1b87b62e423ef8925dd7522e19ce29 |
|
MD5 | 1d8498b8807729315bda7f892abb447d |
|
BLAKE2b-256 | a3e7f9f7cff6d8a19e9b386873472504e8507e569dc6ec5b71e2b5239398868b |