Shravy
Shravy

Reputation: 666

How to print amount_to_text in Indian Rupees format in Odoo reports.?

I was trying to print the invoice amount in words in Odoo,

Following is the code in .py

@api.multi
    def amount_to_text(self, amount_total, currency='INR'):
        return amount_to_text(amount_total, currency)

and following was the code in qweb report,

<div class="row">
            <div class="col-xs-10">
                    <strong><td>Total in words:</td></strong>
                      <span t-esc="o.amount_to_text(o.amount_total, 
'INR')"/>

            </div>
</div>

but the report always shows the words in euros(as in the below image), not able to print it in INR format. Is there any over-riding of amount_to_text method.

Amount in Euro words

Upvotes: 2

Views: 2511

Answers (1)

gdaramouskas
gdaramouskas

Reputation: 3747

First of all go to Settings -> Reports -> Reports and search for invoices in order to find the Invoice report that interests you. Open it, and uncheck Reload from attachment.

If Reload from attachment is checked only the first time the report will be generated for a record and it will be saved in the database. If you try to re-print the report (for the same record), Odoo will fetch the saved one and will not re-render a new one.

Also, I checked the definition of this method of Odoo and it does not match your definition.

On openerp/tools/amount_to_text.py around line 170 you will find the definition of this method. You can see that it is a static method that is offered as a tool so the proper way to use this method would be:

from openerp.tools.amount_to_text import amount_to_text

Now you can call the method with the relevant arguments. The method is sufficiently documented and you can figure out easily how it is used.

Upvotes: 1

Related Questions