Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
3 Risposte
7704 Visualizzazioni

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
Abbandona
Autore Risposta migliore

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
Abbandona

Thankx...

Risposta migliore

  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
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
mar 23
1930
2
gen 22
3168
0
lug 21
2886
7
giu 21
17139
8
mag 20
5845