Search 1.9 billion lines of Odoo code on GitHub

email_template_currency

Author: initOS GmbH, Odoo Community Association (OCA)
License: AGPL-3
Branch: 10.0-email_template_currency
Repository: initOS/server-tools
Dependencies: mail
Languages: Python (44, 100.0%)

<a class="reference external image-reference" 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.svg"> </a> <a name="email-template-filter-currency"></a> <h2>Email Template: Filter &quot;Currency&quot;</h2> <p>This module adds an extra Jinja filter for email templates:</p> <dl class="docutils"> <dt><em>currency(currency_obj=None, lang=None, use_symbol=False)</em></dt> <dd>Formats a currency value. The optional parameter <em>currency_obj</em> allows specifying the currency browse record, which will be used to also display the currency symbol (default: none). The optional parameter <em>lang</em> allows specifying the language to be used for formatting the numerical value, e.g. for displaying the decimal separator (e.g., point or comma) (example: 'de_DE'; default: 'lang' of the context). The optional Boolean parameter <em>use_symbol</em> indicates that the currency symbol (or: sign, e.g. &quot;€&quot;) should be displayed instead of the short name (or: code, e.g. &quot;EUR&quot;) (default: <em>False</em>).</dd> </dl> <a name="usage"></a> <h3>Usage</h3> <p>In an email template, when displaying a currency amount by using a straight-forward expression like</p> <blockquote> ${object.amount_total} ${object.pricelist_id.currency_id.name}</blockquote> <p>(cf. the <em>email.template</em> &quot;Sales Order - Send by Email&quot;) yields a display where the value is formatted by Python like any floating point number:</p> <img alt="The picking tree view with 'Progress' progress bar" src="images/sale_order_email_before.png" /> <p>For currency amounts, this is usually not desired. Using the new Jinja-Filter <em>currency</em> from this module instead, e.g.</p> <blockquote> ${object.amount_total|currency(currency_obj=object.currency_id,lang=object.partner_id.lang)}</blockquote> <p>yields a more appropriate display:</p> <img alt="The picking tree view with 'Progress' progress bar" src="images/sale_order_email_after.png" /> <a name="bug-tracker"></a> <h3>Bug Tracker</h3> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/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 feedback <a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20email_template_currency%0Aversion:%2010.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">here</a>.</p> <a name="credits"></a> <h3>Credits</h3> <a name="contributors"></a> <h4>Contributors</h4> <ul class="simple"> <li>Andreas Zöllner (initOS) &lt;<a class="reference external" href="mailto:andreas.zoellner&#64;initos.com">andreas.zoellner&#64;initos.com</a>&gt;</li> </ul> <a name="maintainer"></a> <h4>Maintainer</h4> <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>This module is maintained by the OCA.</p> <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>To contribute to this module, please visit <a class="reference external" href="https://odoo-community.org">https://odoo-community.org</a>.</p> <a name="acknowledgments"></a> <h4>Acknowledgments</h4> <p>This module has been inspired by the module <em>email_template_dateutil</em>.</p>