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**
**Table of contents**
..contents::
..contents::
@ -35,9 +59,6 @@ Configuration
Go to *Settings > Technical > Reporting > Comment Templates* and start designing you comment templates.
Go to *Settings > Technical > Reporting > Comment Templates* and start designing you comment templates.
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 partner.
This module is the base module for following modules:
This module is the base module for following modules:
* sale_comment_template
* sale_comment_template
@ -48,6 +69,7 @@ This module is the base module for following modules:
Usage
Usage
=====
=====
#. Go to *Settings* and activate the developer mode.
#. Go to *Settings > Technical > Reporting > Comment Templates*.
#. Go to *Settings > Technical > Reporting > Comment Templates*.
#. Create a new record.
#. Create a new record.
#. Define the Company the template is linked or leave default for all companies.
#. Define the Company the template is linked or leave default for all companies.
@ -61,7 +83,7 @@ Usage
You should have at least one template with Default field set, if you choose a Partner the template is deselected as a Default one.
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.
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 a mail template, so you can use variables like ${object}, ${user}, ${ctx} to add dynamic content.
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:
Change the report related to the model from configuration and add a statement like:
@ -79,7 +101,6 @@ Change the report related to the model from configuration and add a statement li
You should always use t-if since the method returns False if no template is found.
You should always use t-if since the method returns False if no template is found.
<p><aclass="reference external"href="https://odoo-community.org/page/development-status"><imgalt="Beta"src="https://img.shields.io/badge/maturity-Beta-yellow.png"/></a><aclass="reference external"href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><imgalt="License: AGPL-3"src="https://img.shields.io/badge/licence-AGPL--3-blue.png"/></a><aclass="reference external"href="https://github.com/OCA/reporting-engine/tree/14.0/base_comment_template"><imgalt="OCA/reporting-engine"src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github"/></a><aclass="reference external"href="https://translation.odoo-community.org/projects/reporting-engine-14-0/reporting-engine-14-0-base_comment_template"><imgalt="Translate me on Weblate"src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png"/></a><aclass="reference external"href="https://runbot.odoo-community.org/runbot/143/14.0"><imgalt="Try me on Runbot"src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png"/></a></p>
<p>Add a new model to define templates of comments to print on
documents.</p>
<p>Two positions are available for the comments:
* above document lines
* below document lines</p>
<p><aclass="reference external"href="https://odoo-community.org/page/development-status"><imgalt="Beta"src="https://img.shields.io/badge/maturity-Beta-yellow.png"/></a><aclass="reference external"href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><imgalt="License: AGPL-3"src="https://img.shields.io/badge/licence-AGPL--3-blue.png"/></a><aclass="reference external"href="https://github.com/OCA/reporting-engine/tree/13.0/base_comment_template"><imgalt="OCA/reporting-engine"src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github"/></a><aclass="reference external"href="https://translation.odoo-community.org/projects/reporting-engine-13-0/reporting-engine-13-0-base_comment_template"><imgalt="Translate me on Weblate"src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png"/></a><aclass="reference external"href="https://runbot.odoo-community.org/runbot/143/13.0"><imgalt="Try me on Runbot"src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png"/></a></p>
<p>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.</p>
<p>Two positions are available for the comments:</p>
<ulclass="simple">
<li>above document lines (before_lines)</li>
<li>below document lines (after_lines)</li>
</ul>
<p>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)</p>
<p>In existing reports, if you add this line will get the comment template if you created one like</p>
<ulclass="simple">
<li><span t-raw=”o.get_comment_template(‘position’,company_id=o.company_id, partner_id=o.parnter_id )”/> ( or without any parameter)</li>
</ul>
<p>This module is the base module for following modules:</p>
<p>This module is the base module for following modules:</p>
<li>Go to <em>Settings</em> and activate the developer mode.</li>
<li>Go to <em>Settings > Technical > Reporting > Comment Templates</em>.</li>
<li>Create a new record.</li>
<li>Define the Company the template is linked or leave default for all companies.</li>
<li>Define the Partner the template is linked or leave default for all partners.</li>
<li>Define the Model, Domain the template is linked.</li>
<li>Define the Position where the template will be printed:<ul>
<li>above document lines</li>
<li>below document lines</li>
</ul>
</li>
</ol>
<p>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.</p>
<p>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.</p>
<p>Change the report related to the model from configuration and add a statement like:</p>
<p><p t-if=”o.get_comment_template(‘before_lines’, o.company_id.id, o.partner_id and o.partner_id.id or False)”></p>
<blockquote>
<span t-raw=”o.get_comment_template(‘before_lines’, o.company_id.id, o.partner_id and o.partner_id.id or False)”/></blockquote>
<p></p></p>
<p><p t-if=”o.get_comment_template(‘after_lines’, o.company_id.id, o.partner_id and o.partner_id.id or False)”></p>
<blockquote>
<span t-raw=”o.get_comment_template(‘after_lines’, o.company_id.id, o.partner_id and o.partner_id.id or False)”/></blockquote>
<p></p></p>
<p>You should always use t-if since the method returns False if no template is found.</p>
<aclass="reference external image-reference"href="https://odoo-community.org"><imgalt="Odoo Community Association"src="https://odoo-community.org/logo.png"/></a>
<aclass="reference external image-reference"href="https://odoo-community.org"><imgalt="Odoo Community Association"src="https://odoo-community.org/logo.png"/></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
promote its widespread use.</p>
<p>This module is part of the <aclass="reference external"href="https://github.com/OCA/reporting-engine/tree/14.0/base_comment_template">OCA/reporting-engine</a> project on GitHub.</p>
<p>This module is part of the <aclass="reference external"href="https://github.com/OCA/reporting-engine/tree/13.0/base_comment_template">OCA/reporting-engine</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <aclass="reference external"href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
<p>You are welcome to contribute. To learn how please visit <aclass="reference external"href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>