Add conditional mako template to any report on models that inherits comment.template.
Project description
Add a new mixin class to define templates of comments to print on documents. The comment templates can be defined like make templates, so you can use variables from linked models.
Two positions are available for the comments:
above document lines (before_lines)
below document lines (after_lines)
The template are general, and can be attached to any Model and based on some domain defined in the template. You can define one default template per Model and domain, which can be overwritten for any company and partners. It has a priority field (smaller number = higher priority)
In existing reports, if you add this line will get the comment template if you created one like
<span t-raw=”o.get_comment_template(‘position’,company_id=o.company_id, partner_id=o.parnter_id )”/> ( or without any parameter)
This module is the base module for following modules:
sale_comment_template
purchase_comment_template
invoice_comment_template
stock_picking_comment_template
Table of contents
Configuration
Go to Settings > Technical > Reporting > Comment Templates and start designing you comment templates.
This module is the base module for following modules:
sale_comment_template
purchase_comment_template
invoice_comment_template
stock_picking_comment_template
Usage
Go to Settings and activate the developer mode.
Go to Settings > Technical > Reporting > Comment Templates.
Create a new record.
Define the Company the template is linked or leave default for all companies.
Define the Partner the template is linked or leave default for all partners.
Define the Model, Domain the template is linked.
Define the Position where the template will be printed:
above document lines
below document lines
You should have at least one template with Default field set, if you choose a Partner the template is deselected as a Default one. If you create a new template with the same configuration (Model, Domain, Position) and set it as Default, the previous one will be deselected as a default one.
The template is a html field which will be rendered just like a mail template, so you can use variables like ${object}, ${user}, ${ctx} to add dynamic content.
Change the report related to the model from configuration and add a statement like:
<p t-if=”o.get_comment_template(‘before_lines’, o.company_id.id, o.partner_id and o.partner_id.id or False)”>
<span t-raw=”o.get_comment_template(‘before_lines’, o.company_id.id, o.partner_id and o.partner_id.id or False)”/>
</p>
<p t-if=”o.get_comment_template(‘after_lines’, o.company_id.id, o.partner_id and o.partner_id.id or False)”>
<span t-raw=”o.get_comment_template(‘after_lines’, o.company_id.id, o.partner_id and o.partner_id.id or False)”/>
</p>
You should always use t-if since the method returns False if no template is found.
Bug Tracker
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback.
Do not contact contributors directly about support or help with technical issues.
Credits
Contributors
Xavier Jimenez <xavier.jimenez@qubiq.es>
Nicolas Bessi <nicolas.bessi@camptocamp.com>
Yannick Vaucher <yannick.vaucher@camptocamp.com>
Guewen Baconnier <guewen.baconnier@camptocamp.com>
Simone Rubino <simone.rubino@agilebg.com>
-
Raf Ven <raf.ven@dynapps.be>
-
Iván Todorovich <ivan.todorovich@druidoo.io>
-
Fekete Mihai <feketemihai@nexterp.ro>
-
Carlos Roca
Víctor Martínez
Maintainers
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
This module is part of the OCA/reporting-engine project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
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
Built Distribution
File details
Details for the file odoo13_addon_base_comment_template-13.0.3.0.3-py3-none-any.whl
.
File metadata
- Download URL: odoo13_addon_base_comment_template-13.0.3.0.3-py3-none-any.whl
- Upload date:
- Size: 147.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d26029be9bfd9475123b315f946aa2a8f00666f748ddc3477ef85e5978ed074a |
|
MD5 | b469ad788be33ec26d38f97895e36f7d |
|
BLAKE2b-256 | 8335f6de6a30d1413cc84d44b28bae807c949bb1a11e5aced4f91326e7dc4c41 |