Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
3 Respostas
7709 Visualizações

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
Cancelar
Autor Melhor resposta

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
Cancelar

Thankx...

Melhor resposta

  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
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
1
mar. 23
1930
2
jan. 22
3168
0
jul. 21
2886
7
jun. 21
17139
8
mai. 20
5845