Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How can I convert the amount to text

Mehmet Demirel
on 3/24/15, 7:11 AM 526 views

How can I convert the amount to text? This work should not be so difficult. Please get someone to explain in the simplest way these work.

Didn't get exactly what you meant? You want to convert the float value to string?

Akhil P Sivan
on 3/24/15, 7:17 AM


| 6 4 7
Lodz, Poland

On 3/24/15, 10:27 AM

Example from account_voucher.py:

from openerp.tools.amount_to_text_en import amount_to_text

def _amount_to_text(self, cr, uid, amount, currency_id, context=None):

# Currency complete name is not available in res.currency model

# Exceptions done here (EUR, USD, BRL) cover 75% of cases

# For other currencies, display the currency code

currency = self.pool['res.currency'].browse(cr, uid, currency_id, context=context)

if currency.name.upper() == 'EUR':

currency_name = 'Euro'

elif currency.name.upper() == 'USD':

currency_name = 'Dollars'

elif currency.name.upper() == 'BRL':

currency_name = 'reais'


currency_name = currency.name

#TODO : generic amount_to_text is not ready yet, otherwise language (and country) and currency can be passed

#amount_in_word = amount_to_text(amount, context=context)

return amount_to_text(amount, currency=currency_name)

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 3/24/15, 7:11 AM
Seen: 526 times
Last updated: 3/24/15, 10:27 AM