Odoo Help
Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM
|
e-Commerce
|
Accounting
|
Inventory
|
PoS
|
Project management
|
MRP
|
etc.
detailed procedure to do the number to text conversion [Closed]
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...
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)
or
'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}}
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...
It is just an indentation error. Make sure your code is indented(give tab) properly.
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.
RegisterOdoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.
Test it nowQuestion tools
Stats
Asked: 4/9/13, 9:39 AM |
Seen: 5030 times |
Last updated: 3/16/15, 8:10 AM |