This question has been flagged
3 Replies
6241 Views

I want to convert the amount total of invoice to words both integer and decimal part.

For Example

 amount_total = 1500.50
One thousand five hundred rupees and fifty paise if currency is INR
One thousand five hundred euro and fifty cents if currency is EURO



Avatar
Discard
Author Best Answer

from odoo.tools import amount_to_text_en

def set_amt_in_worlds(self):
amount, currency = self.amount_total, self.currency_id.name
amount_in_words = amount_to_text_en.amount_to_text(amount, lang='en', currency=currency)
if currency == 'INR':
amount_in_words = str(amount_in_words).replace('INR', 'rupees')
amount_in_words = str(amount_in_words).replace('Cents', 'paise')
amount_in_words = str(amount_in_words).replace('Cent', 'paise')
amount_in_words += '\tonly'
self.amt_in_words = amount_in_words.capitalize()
amt_in_words = fields.Char(compute='set_amt_in_worlds')



Avatar
Discard

Thankx...

Best Answer

  Shameem Babu @ iWesabe,   can you please help how we can make it work in odoo9 as I am very new and have no knowledge of coding, can you please let us knew where to add  "from odoo.tools import amount_to_text_en"  and rest of the code? please let me knew which files need to amend and where to place above codes as those are in three parts?

Avatar
Discard