Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
3 Ответы
7708 Представления

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



Аватар
Отменить
Автор Лучший ответ

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



Аватар
Отменить

Thankx...

Лучший ответ

  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?

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
мар. 23
1930
2
янв. 22
3168
0
июл. 21
2886
7
июн. 21
17139
8
мая 20
5845