Search 1.9 billion lines of Odoo code on GitHub

base_comment_template

Author: Camptocamp, Odoo Community Association (OCA)
License: AGPL-3
Branch: 16.0-mig-report_csv
Repository: acsone/reporting-engine
Dependencies: base, and mail
Languages: HTML (436, 4.0%), PO File (9630, 88.7%), Python (426, 3.9%), XML (200, 1.8%), and reStructuredText (169, 1.6%)
Other branches: 13.0, 13.0-imp_report_qweb_signer_allowed_reports_tbi, 13.0-ref_report_py3o_python_3.11_tbi, 13.0-report_qweb_element_page_visibility, 13.0-slg_master, 14.0, 14.0-imp_report_qweb_signer_allowed_reports_tbi, 14.0-mig-report_label-dro, 14.0-mig-report_py3o, 14.0-mig-report_py3o_fusion_server, 14.0-update-dotfiles-sbi, 16.0, add-report_py3o_signer-lco, and imp-temp-remove-java-in-manifest-lco
Other repositories: AITIC/reporting-engine, BeopenMX/account-invoice-reporting, Bubbles-IT/account-invoice-reporting, Change2improve/account-invoice-reporting, Change2improve/reporting-engine, ClearCorp/oca-account-invoice-reporting, Cloudxtreme/account-invoice-reporting, Comunitea/reporting-engine, Darknroses/account-invoice-reporting, Darknroses/reporting-engine, Digital5-Odoo/reporting-engine, Dobtor-OCA/reporting-engine, EBII/account-invoice-reporting, EBII/reporting-engine, ERPLibre/account-invoice-reporting, Endika/account-invoice-reporting, FlorianoMincone/account-invoice-reporting, ForgeFlow/account-invoice-reporting, ForgeFlow/reporting-engine, Gabinete-Digital/account-invoice-reporting, Gabinete-Digital/reporting-engine, Gofekra/account-invoice-reporting, GrupoAlvamex/account-invoice-reporting, Guobower/account-invoice-reporting, HomerDeoDatu/account-invoice-reporting, Ingeos/account-invoice-reporting, Ingeos/reporting-engine, Jarsa/account-invoice-reporting, Jarsa/reporting-engine, Jeisonpernia/account-invoice-reporting, JibenCL/account-invoice-reporting, LevelPrime/account-invoice-reporting, MadsackMediaStore/account-invoice-reporting, MariajMesa/account-invoice-reporting, MathBenTech/account-invoice-reporting, Mefistous/account-invoice-reporting, NextERP-Romania/account-invoice-reporting, NextERP-Romania/reporting-engine, Nikul-Chaudhary/account-invoice-reporting, OCA-MUK/account-invoice-reporting, OCA/account-invoice-reporting, OCA/reporting-engine, PlanetaTIC/account-invoice-reporting, QubiQ/account-invoice-reporting, Rad0van/reporting-engine, SGiuseppe/account-invoice-reporting, SanteLibre/account-invoice-reporting, SerpentConsultingServices/account-invoice-reporting, SeuMarco/account-invoice-reporting, SeuMarco/reporting-engine, SimoRubi/account-invoice-reporting, StefanRijnhart/reporting-engine, Studio73/account-invoice-reporting, Studio73/reporting-engine, Syci-Consulting/account-invoice-reporting, TRESCLOUD/reporting-engine, Tecnativa/account-invoice-reporting, Tecnativa/reporting-engine, Vauxoo/account-invoice-reporting, Vauxoo/reporting-engine, VisiionSolucionesTecnologicas/account-invoice-reporting, WilldooIT/reporting-engine, acsone/account-invoice-reporting, acsonefho/account-invoice-reporting, adhoc-dev/oca-reporting-engine, adhoc-dev/reporting-engine, akretion/account-invoice-reporting, akretion/reporting-engine, alanljj/account-invoice-reporting, amendoncabh/account-invoice-reporting, andhit-r/reporting-engine, angelmoya/account-invoice-reporting, anhvu-sg/account-invoice-reporting, anhvu-sg/reporting-engine, apachesep/account-invoice-reporting, apetbiz/account-invoice-reporting, archetipo/account-invoice-reporting, artapon/account-invoice-reporting, aurestic/account-invoice-reporting, aurestic/reporting-engine, binhlam/account-invoice-reporting, blooparksystems/reporting-engine, bmya/reporting-engine-1, bodedra/account-invoice-reporting, brain-tec/account-invoice-reporting, brain-tec/reporting-engine, budisentosa/reporting-engine, bvkl/account-invoice-reporting, camptocamp/account-invoice-reporting, camptocamp/reporting-engine, ccarly/account-invoice-reporting, charbeljc/account-invoice-reporting, clb-openfire/account-invoice-reporting, coopiteasy/reporting-engine, damdam-s/account-invoice-reporting, dani-xtendoo/account-invoice-reporting, dcorio/reporting-engine, diagramsoftware/account-invoice-reporting, diggy128/account-invoice-reporting, dong-z/account-invoice-reporting, druidoo-dev/account-invoice-reporting, eLBati/account-invoice-reporting, ecosoft-odoo/account-invoice-reporting, ecosoft-odoo/reporting-engine, emagdalenaC2i/account-invoice-reporting, exosoftware/oca-account-invoice-reporting, flachica/reporting-engine, garzadekoster/account-invoice-reporting, goanzaloo/account-invoice-reporting, grindtildeath/account-invoice-reporting, gsunjka/account-invoice-reporting, guewen/account-invoice-reporting, gurneyalex/account-invoice-reporting, gurneyalex/reporting-engine, haroldtamo/account-invoice-reporting, hurrinico/account-invoice-reporting, ilyasProgrammer/reporting-engine, initOS/account-invoice-reporting, isoscl/account-invoice-reporting, izzihector/account-invoice-reporting, jimhoefnagels/account-invoice-reporting, johnbendi/reporting-engine, kmee/reporting-engine, leNeo/account-invoice-reporting, leemannd/reporting-engine, legalsylvain/reporting-engine, lideritjnma/account-invoice-reporting, maherjaballi/account-invoice-reporting, mehdi-ghezal/account-invoice-reporting, molandtoxx/account-invoice-reporting, moulayrachidhachimi/account-invoice-reporting, murtuzasaleh/account-invoice-reporting, myonnet/oca-reporting-engine, nikul-serpentcs/account-invoice-reporting, odof/account-invoice-reporting, piensom/account-invoice-reporting, pscloud/account-invoice-reporting, puchisco/account-invoice-reporting, raycarnes/account-invoice-reporting, robertsvx27/reporting-engine, rosenvladimirov/account-invoice-reporting, rossasa/account-invoice-reporting, royalline1/account-invoice-reporting, rsanhasan/account-invoice-reporting, rschnapka/account-invoice-reporting, rsullivan2704/account-invoice-reporting, rven/account-invoice-reporting, sadeqamin/account-invoice-reporting, sanube/account-invoice-reporting, savoirfairelinux/account-invoice-reporting, scigghia/account-invoice-reporting, smangukiya/account-invoice-reporting, southasia/account-invoice-reporting, sunflowerit/reporting-engine, sunshineLhj/account-invoice-reporting, tafaRU/account-invoice-reporting, tbaden/reporting-engine, tegin/reporting-engine, unitek-solusi/OCA-account-invoice-reporting, unitek-solusi/OCA-reporting-engine, ursais/account-invoice-reporting, ursais/reporting-engine, valmarnet/account-invoice-reporting, versada/reporting-engine, vrenaville/account-invoice-reporting, wahabalimalik/account-invoice-reporting, x0rzkov/odoo-account-invoice-reporting, xcgd/reporting-engine, ygol/account-invoice-reporting, yostashiro/account-invoice-reporting, yucer/account-invoice-reporting, and zhaohuaw/reporting-engine

<h1 class="title">Base Comments Templates</h1> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/16.0/base_comment_template"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/reporting-engine-16-0/reporting-engine-16-0-base_comment_template"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/143/16.0"><img alt="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> <ul class="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> <ul class="simple"> <li>&lt;span t-raw=&quot;o.get_comment_template('position',company_id=o.company_id, partner_id=o.parnter_id )&quot;/&gt; ( or without any parameter)</li> </ul> <p>This module is the base module for following modules:</p> <ul class="simple"> <li>sale_comment_template</li> <li>purchase_comment_template</li> <li>invoice_comment_template</li> <li>stock_picking_comment_template</li> </ul> <p><strong>Table of contents</strong></p> <div class="contents local topic" id="contents"> <ul class="simple"> <li><a class="reference internal" href="#configuration" id="id1">Configuration</a></li> <li><a class="reference internal" href="#usage" id="id2">Usage</a></li> <li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li> <li><a class="reference internal" href="#credits" id="id4">Credits</a><ul> <li><a class="reference internal" href="#authors" id="id5">Authors</a></li> <li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li> <li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li> </ul> </li> </ul> </div> <a name="configuration"></a> <h2><a class="toc-backref" href="#id1">Configuration</a></h2> <p>Go to <em>Settings &gt; Technical &gt; Reporting &gt; Comment Templates</em> and start designing you comment templates.</p> <p>This module is the base module for following modules:</p> <ul class="simple"> <li>sale_comment_template</li> <li>purchase_comment_template</li> <li>invoice_comment_template</li> <li>stock_picking_comment_template</li> </ul> <a name="usage"></a> <h2><a class="toc-backref" href="#id2">Usage</a></h2> <ol class="arabic simple"> <li>Go to <em>Settings</em> and activate the developer mode.</li> <li>Go to <em>Settings &gt; Technical &gt; Reporting &gt; 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> <dl class="docutils"> <dt>&lt;t t-foreach=&quot;o.comment_template_ids.filtered(lambda x: x.position == 'before_lines')&quot; t-as=&quot;comment_template_top&quot;&gt;</dt> <dd>&lt;div t-raw=&quot;o.render_comment(comment_template_top)&quot; /&gt;</dd> </dl> <p>&lt;/t&gt;</p> <dl class="docutils"> <dt>&lt;t t-foreach=&quot;o.comment_template_ids.filtered(lambda x: x.position == 'after_lines')&quot; t-as=&quot;comment_template_bottom&quot;&gt;</dt> <dd>&lt;div t-raw=&quot;o.render_comment(comment_template_bottom)&quot; /&gt;</dd> </dl> <p>&lt;/t&gt;</p> <p>You should always use t-if since the method returns False if no template is found.</p> <p>If you want to use Qweb templates, or different context, you can specify it just like in mail.render.mixin with parameters:</p> <ul class="simple"> <li>engine: &quot;inline_template&quot;, &quot;qweb&quot; or &quot;qweb_view&quot;,</li> <li>add_context: dict with your own context,</li> <li>post_process: perform a post processing on rendered result</li> </ul> <p>so you could use it :</p> <dl class="docutils"> <dt>&lt;t t-foreach=&quot;o.comment_template_ids.filtered(lambda x: x.position == 'before_lines')&quot; t-as=&quot;comment_template_top&quot;&gt;</dt> <dd>&lt;div t-raw=&quot;o.render_comment(comment_template_top, engine='qweb', add_context={my dict}, postprocess=True)&quot; /&gt;</dd> </dl> <p>&lt;/t&gt;</p> <a name="bug-tracker"></a> <h2><a class="toc-backref" href="#id3">Bug Tracker</a></h2> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/reporting-engine/issues">GitHub Issues</a>. 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 <a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20base_comment_template%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <p>Do not contact contributors directly about support or help with technical issues.</p> <a name="credits"></a> <h2><a class="toc-backref" href="#id4">Credits</a></h2> <a name="authors"></a> <h3><a class="toc-backref" href="#id5">Authors</a></h3> <ul class="simple"> <li>Camptocamp</li> </ul> <a name="contributors"></a> <h3><a class="toc-backref" href="#id6">Contributors</a></h3> <ul class="simple"> <li>Xavier Jimenez &lt;<a class="reference external" href="mailto:xavier.jimenez&#64;qubiq.es">xavier.jimenez&#64;qubiq.es</a>&gt;</li> <li>Nicolas Bessi &lt;<a class="reference external" href="mailto:nicolas.bessi&#64;camptocamp.com">nicolas.bessi&#64;camptocamp.com</a>&gt;</li> <li>Yannick Vaucher &lt;<a class="reference external" href="mailto:yannick.vaucher&#64;camptocamp.com">yannick.vaucher&#64;camptocamp.com</a>&gt;</li> <li>Guewen Baconnier &lt;<a class="reference external" href="mailto:guewen.baconnier&#64;camptocamp.com">guewen.baconnier&#64;camptocamp.com</a>&gt;</li> <li>Simone Rubino &lt;<a class="reference external" href="mailto:simone.rubino&#64;agilebg.com">simone.rubino&#64;agilebg.com</a>&gt;</li> <li><a class="reference external" href="https://www.dynapps.be">DynApps</a>:<ul> <li>Raf Ven &lt;<a class="reference external" href="mailto:raf.ven&#64;dynapps.be">raf.ven&#64;dynapps.be</a>&gt;</li> </ul> </li> <li><a class="reference external" href="https://www.druidoo.io">Druidoo</a>:<ul> <li>Iván Todorovich &lt;<a class="reference external" href="mailto:ivan.todorovich&#64;druidoo.io">ivan.todorovich&#64;druidoo.io</a>&gt;</li> </ul> </li> <li>Pierre Verkest &lt;<a class="reference external" href="mailto:pierreverkest84&#64;gmail.com">pierreverkest84&#64;gmail.com</a>&gt;</li> <li><a class="reference external" href="https://www.nexterp.ro">NextERP Romania</a>:<ul> <li>Fekete Mihai &lt;<a class="reference external" href="mailto:feketemihai&#64;nexterp.ro">feketemihai&#64;nexterp.ro</a>&gt;</li> </ul> </li> <li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul> <li>Carlos Roca</li> <li>Víctor Martínez</li> </ul> </li> <li><a class="reference external" href="https://www.jarsa.com">Jarsa</a>:<ul> <li>Alan Ramos &lt;<a class="reference external" href="mailto:alan.ramos&#64;jarsa.com">alan.ramos&#64;jarsa.com</a>&gt;</li> </ul> </li> <li><a class="reference external" href="https://www.bloopark.de/">Bloopark systems</a>:<ul> <li>Achraf Mhadhbi &lt;<a class="reference external" href="mailto:machraf&#64;bloopark.de">machraf&#64;bloopark.de</a>&gt;</li> </ul> </li> </ul> <a name="maintainers"></a> <h3><a class="toc-backref" href="#id7">Maintainers</a></h3> <p>This module is maintained by the OCA.</p> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <p>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.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/16.0/base_comment_template">OCA/reporting-engine</a> project on GitHub.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>