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
File details
Details for the file trytoncalidae_jinja_report-7.0.1.tar.gz
.
File metadata
- Download URL: trytoncalidae_jinja_report-7.0.1.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73486f834ca79b5c210315c52336a1eca42438baf06c184e39c1eb171bbbdb54 |
|
MD5 | 348c6234933beb9309aad6d0a4616813 |
|
BLAKE2b-256 | face547a139fac438baf22b36a58c3b7b31fa963cd839da7027899af881c0a97 |
File details
Details for the file trytoncalidae_jinja_report-7.0.1-py3-none-any.whl
.
File metadata
- Download URL: trytoncalidae_jinja_report-7.0.1-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6acc8fca8126086add44e5c32405cb4e258006ab26399dc47053e8af3aed524 |
|
MD5 | 3924765e72512fcfdc866ff865404da6 |
|
BLAKE2b-256 | 51d9136ba52cb0563e3e1b835b18415498d797c95da99bcf353242a94816521d |