Search code examples
python-2.7odooopenerp-7odoo-8

Custom module's configuration file in Odoo


I am using Odoo 8 in ubuntu 14.04 environment. I installed a custom module with its config file which has some static values.

I am facing File not found error when need to load that config file.

The Addons path is resided outside of Odoo directory(i.e I was configured in odoo conf file)

addons_path = /usr/lib/python2.7/dist-packages/odoo/addons

The module is resided in above location.

Previously, I get config file from odoo file directory using command..

file_cfg = os.path.abspath(os.path.join(tools.config['root_path'], '../openerp/addons/custom_module/custom_cfg.cfg'))

It does not work out. Hence I hardcoded the path in python file as

file_cfg = '/usr/lib/python2.7/dist-packages/odoo/addons/custom_module/custom_cfg.cfg'

How do I get the config file programmatically ?

Please give a suggestion...


Solution

  • You can try this:

    file_cfg = os.path.abspath(os.path.join(tools.config['root_path'], '../odoo/addons/custom_module/custom_cfg.cfg'))