Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3 Răspunsuri
7707 Vizualizări

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



Imagine profil
Abandonează
Autor Cel mai bun răspuns

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')



Imagine profil
Abandonează

Thankx...

Cel mai bun răspuns

  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?

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
mar. 23
1930
2
ian. 22
3168
0
iul. 21
2886
7
iun. 21
17139
8
mai 20
5845