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.
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.
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
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
|Asked: 9/5/14, 5:27 PM|
|Seen: 2568 times|
|Last updated: 3/16/15, 8:10 AM|