Odoo Help


detailed procedure to do the number to text conversion [Closed]

on 4/9/13, 9:39 AM 5,030 views

The Question has been closed

Sudhir Arya (ERP Harbor Consulting Services)
on 04/18/2013 05:17:34

hey all!!! i wanted to display my amount figure in words....whether PO,SO etc wherever it is and i also want a field which will do that>....help me....help me openerp community...plz help me...it would be helpful...


Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 




Sudhir Arya
ERP Harbor Consulting Services
Sudhir Arya (ERP Harbor Consulting Services)
On 4/9/13, 9:49 AM

To convert amount to text, you can use the amount_to_text method defined in openerp/tools/amount_to_text_en.py

Create a field which will store text value of amount. You can either create char or text field.

'text_amount': fields.char("Text Amount", size=100)


'text_amount': fields.text("Text Amount")

Now write a on_change method which will be called when you change the value of amount field. First add on_change in your xml where your amount field is.

Like this:

<field name="your_amount_field" on_change="onchange_amount(your_amount_field)"/>

Write the following code inside your class in your py:

from openerp.tools import amount_to_text_en

def onchange_amount(self, cr, uid, ids, amount):
    text_amount = amount_to_text_en.amount_to_text(amount, 'en', 'EURO')
    return {'value': {'text_amount': text_amount}}

Perfect Sudhir !

Serpent Consulting Services Pvt. Ltd.
on 4/9/13, 9:57 AM

Thank you for the compliment.

Sudhir Arya (ERP Harbor Consulting Services)
on 4/9/13, 9:58 AM

i get an error like File "C:\Program Files\OpenERP 6.0\Server\addons\crm\crm_lead.py", line 180 text_amount = amount_to_text_en.amount_to_text(amount, 'en', 'EURO') ^ IndentationError: expected an indented block..this is the last 3 lines of my error...

on 4/13/13, 4:46 AM

It is just an indentation error. Make sure your code is indented(give tab) properly.

Sudhir Arya (ERP Harbor Consulting Services)
on 4/13/13, 7:33 AM
Anas Gaffar
On 5/23/14, 5:52 PM

See my updated answer.

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/9/13, 9:39 AM
Seen: 5030 times
Last updated: 3/16/15, 8:10 AM