I am a beginner in programming both python and Odoo. I need a amount to text function that will display amount total in text in the printed invoice. I tried to follow this QWeb report tutorial: https://www.youtube.com/watch?v=tCAUm3MWYzk
Somehow I could create a module that modify the printed pdf. But I really don't have idea on how to put amount in text in the invoice PDF. I have searched the Odoo forum, only to find these guidances that failed to make me understand since I'm a noob:
https://www.odoo.com/forum/help-1/question/detailed-procedure-to-do-the-number-to-text-conversion-10504
https://www.odoo.com/forum/help-1/question/conversion-of-amount-to-text-in-openerp-43765
Here is the file content that modify the original report_invoice.xml. How to call the amount_to_text function in this report_invoice.xml below with the amount_to_text function that already exists in odoo/openerp/tools/amount_to_text.py?
addons/amount_text/views/report_invoice.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_invoice_document_inherit" inherit_id="account.report_invoice_document">
<xpath expr="//div[@class='page']/div[@class='row mt32 mb32']" position="replace">
<div class="row mt32 mb32">32 mb32']" position="replace">
<div class="row mt32 mb32">
<div class="col-xs-2" t-if="o.name">
<strong>Keterangan:</strong>
<p t-field="o.name"/>
</div>
<div class="col-xs-2" t-if="o.date_invoice">
<strong>Tanggal Invoice:</strong>
<p t-field="o.date_invoice"/>
</div>
<div class="col-xs-2" t-if="o.origin">
<strong>Asal:</strong>
<p t-field="o.origin"/>
</div>
<div class="col-xs-2" t-if="o.partner_id.ref">
<strong>Kode Customer:</strong>
<p t-field="o.partner_id.ref"/>
</div>
<div class="col-xs-2" t-if="o.reference">
<strong>Referensi:</strong>
<p t-field="o.reference"/>
</div>
</div>
</xpath>
<xpath expr="//table[@class='table table-condensed']" position="after">
<p>
<strong>Amount in Text:</strong>
<!-- <span t-esc="openerp.tools.amount_to_text(o.amount_total, 'usd')"/> -->
</p>
</xpath>
</template>
</data>
</openerp>
Pravitha thank you very much
Thanks for sharing.