<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="base-amount-to-text"></a>
<h2>Base Amount To Text</h2>
<p>This module allows defining method "amount to text" as python code.
The method can be registered for each languanges or currencies.</p>
<a name="installation"></a>
<h3>Installation</h3>
<p>To install this module, you need to:</p>
<ol class="arabic simple">
<li>Clone the branch 8.0 of the repository <a class="reference external" href="https://github.com/OCA/server-tools">https://github.com/OCA/server-tools</a></li>
<li>Add the path to this repository in your configuration (addons-path)</li>
<li>Update the module list</li>
<li>Go to menu <em>Setting -> Modules -> Local Modules</em></li>
<li>Search For <em>Base Amount To Text</em></li>
<li>Install the module</li>
</ol>
<a name="usage"></a>
<h3>Usage</h3>
<p>To use this module, you need to:</p>
<ol class="arabic">
<li><p class="first">Go to menu <em>Setting -> Translations -> Languanges</em> or
Go to menu <em>Accounting -> Miscellaneous -> Currencies</em></p>
</li>
<li><p class="first">Edit or create one.</p>
</li>
<li><p class="first">There will be a new field named <em>Amount To Text</em></p>
</li>
<li><p class="first">Click add an item</p>
</li>
<li><p class="first">There will be a new field named <em>Python Definition for Method Amount To Text</em></p>
</li>
<li><p class="first">Fill this field with a python code</p>
</li>
<li><p class="first">To call the method use <model:base.amount_to_text>.amount_to_text(value)
Example: account_invoice</p>
<p>obj_base_amount2text = self.env['base.amount_to_text']
obj_res_currency = self.env['res.currency']
obj_res_lang = self.env['res.lang']</p>
<dl class="docutils">
<dt>lang = self.obj_res_lang.search(</dt>
<dd><p class="first last">[('code', '=', 'en_US')])</p>
</dd>
<dt>curr = self.obj_res_currency.search(</dt>
<dd><p class="first last">[('name', '=', 'IDR')])</p>
</dd>
<dt>amount2text = self.obj_amount2text.search([</dt>
<dd><p class="first last">('currency_id', '=', curr.id),
('lang_id', '=', lang.id)</p>
</dd>
</dl>
<p>])</p>
<p>result = amount2text.amount_to_text(self.amount_total)</p>
</li>
</ol>
<a class="reference external image-reference" href="https://runbot.odoo-community.org/runbot/149/8.0"><img alt="Try me on Runbot" src="https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas" /></a>
<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.</p>
<a name="credits"></a>
<h3>Credits</h3>
<a name="images"></a>
<h4>Images</h4>
<ul class="simple">
<li>Odoo Community Association: <a class="reference external" href="https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg">Icon</a>.</li>
</ul>
<a name="contributors"></a>
<h4>Contributors</h4>
<ul class="simple">
<li>Michael Viriyananda <<a class="reference external" href="mailto:viriyananda.michael@gmail.com">viriyananda.michael@gmail.com</a>></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>