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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file trytoncalidae_jinja_report-6.4.1-py3-none-any.whl
.
File metadata
- Download URL: trytoncalidae_jinja_report-6.4.1-py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc170ce7315c5c45ee90c7c1772dd9b079adeff875f5216c2b54479a45fc33ed |
|
MD5 | b8e12198bf4774848d9a874ac1760503 |
|
BLAKE2b-256 | fd7e52628cb3b36a0e0edc55aa0a3f024a71eed8ca713b0f4a76a756b1f1e336 |