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.2.0-py3-none-any.whl
.
File metadata
- Download URL: trytoncalidae_jinja_report-6.2.0-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0aac4e2211fac66a2731a752856e7ce5d50a5d5ab03b6713321e8935746a5efb |
|
MD5 | 8ab97b9c89758ea8dd55a668b31f3c58 |
|
BLAKE2b-256 | 40c55eb3f50b7db6836de4b62e10bbe312483999c6c80f588cdf6316a8cafb3a |