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.4.0.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trytoncalidae_jinja_report-7.4.0-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for trytoncalidae_jinja_report-7.4.0.tar.gz
Algorithm Hash digest
SHA256 1d5375c8663f66415bdbc538dc3025038cf9bab56dd49fe5a78a163f715f318e
MD5 66e084e5388eda7647218663b21434bf
BLAKE2b-256 523efeac1c759c6e1a6870405ea967eb028885509c0d45871a6f0e0c3669abea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for trytoncalidae_jinja_report-7.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e72894edb7f35b0d4fec7308bcbac185b7454d124e97622cd9e9de0873d443f8
MD5 814651113557d7e3f34d82728cfcbfb3
BLAKE2b-256 cd11f2e3b8a5628764cd8629597e1e63302399dde325691935003079a42ee4b0

See more details on using hashes here.

Supported by

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