This question has been flagged
3 Replies
10660 Views

I wish to add the num2words module to OpenERP as the built in facility to convert numbers to text (ie 42 is Forty Two) is not working for me. 
 

Avatar
Discard
Best Answer

Hi Foster.
When you develop your own module, there are two ways to import it into openerp.

  • First way (Best practice):

You create another folder (i.e..: my_own_addons) in openerp and you put it your own module, after that, you put the path of this folder on the addons_path in the openerp-server.conf file

  • Second way (Not recommended):

you put your own module directly into openerp addons folder.


In the two ways, after putting your own module, you restart your openerp server, you log into your openerp and you go to settings, you click into to upgrade the list of openerp module, you type the name of your module in the search bar, you install it.
Best regards.

Avatar
Discard
Best Answer

Foster,  OpenERP had the feature that you are looking for available in server/openerp/tools/amount_to_text_en.py.  To use it, you just need to add the following line among the imports: from openerp.tools.amount_to_text_en import amount_to_text.  Then you can use it after that declaration: string_to_print = amount_to_text(number_to_convert).  If you want to use it in reports, that's a different story.  Let me know if that's your purpose.

There is also english_number method in case you don't want to use the currency part.

Back to your question, in general there are 2 recommended ways to include a python module into Odoo.

First is to include it into any path that is in your operating system's PYTHONPATH (https://docs.python.org/2/using/cmdline.html#envvar-PYTHONPATH) and use it by way of import.  This is if you want your module to be used by other Python program as well.

Second is to include it in the module that you build.  This is usually easier if you use it only for a one particular module.  You can use it in other modules as well, but do make sure that the dependency is properly set.

 

Avatar
Discard
Author

Thanks John Doe. :-)

Best Answer

Python Module to add in Openrp Server Folder.

For Example in version 7

 Openenerp installed server path to add Python num2words Module.

 C:\Program Files\OpenERP 7.0--\Server\server

Openerp Installed addons path create custom module and Import python module

C:\Program Files\OpenERP 7.0---\Server\server\openerp\addons\cust_module

import num2words

 

 

Avatar
Discard