Skip to main content

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:

  1. Inherit the base Jinja2Report class.
  2. Define the meta model name.
  3. Create an html template.
  4. Create an action report pointing to template path and model name.

Example

Here's a an example of a report which contains three files.

  1. 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')
  1. The html template of your report
<html>
    <body>
        {% for record in records %}
            {{ record.name }}
        {% endfor %}
        {{ data.get('some_data') }}
    </body>
</html>
  1. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trytoncalidae_jinja_report-7.2.0.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

trytoncalidae_jinja_report-7.2.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file trytoncalidae_jinja_report-7.2.0.tar.gz.

File metadata

File hashes

Hashes for trytoncalidae_jinja_report-7.2.0.tar.gz
Algorithm Hash digest
SHA256 3204a61396e24c25f87af91181b3387cdd6afe217cc4881f735d5cdfa6784836
MD5 9977350a0874059ec0f978a0716777f9
BLAKE2b-256 d633eda89d98d12ab4b9af3e39526796e15e4b2586941edb2c9d374a428090a7

See more details on using hashes here.

File details

Details for the file trytoncalidae_jinja_report-7.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for trytoncalidae_jinja_report-7.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c602a58afd2108680242db94bcd6ab699754c3cff83602d71cd7533b55f28d4
MD5 dfcda8fa307fbbf9cea0c82f02bf5bc0
BLAKE2b-256 6e18e213d3c80c1a88a32cc5a35f9eb62e1a2aca28e5423a68bfe97945624a82

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page