How to Setup Custom Addons Path in Odoo Server

Abid Patel
31-Oct-2024 Updated : 31-Oct-2024

Learn how to set up a custom addons path in Odoo server for better organization of custom modules. Follow steps to configure and verify your custom directory setup.

How to Setup Custom Addons Path in Odoo Server

Establishing customized addons path in Odoo is key. It's vital for proper module organization and management. Particularly if you are developing custom modules apart from Odoo code. This guide clarifies why custom paths are handy. It explains setting them up. Also, it provides some best practices.

Custom Addons Path Setup

Setting up customized path for addons in Odoo means specifying this in Odoo configuration file or command line.

Step 1: Make a Custom Addons Directory

First, make a new directory. This directory is to store custom modules. Take for example:

command

mkdir /opt/odoo/custom_addons

Step 2: Integrate Path to Odoo Configuration File

To use this path, you need to add it to Odoo configuration file (odoo.conf). Open the configuration file with your chosen text editor.

command

nano /etc/odoo/odoo.conf

Next look for line for addons_path. Then, you must incorporate the path to the recent custom directory. If the line for addons_path isn't there you can put it in. Separate many paths with commas:

command

addons_path = /opt/odoo/addons,/opt/odoo/custom_addons

Step 3: Start Odoo Service Again

After altering configuration file, restart Odoo server. This is required for the changes in the setup to take hold.

command

sudo systemctl restart odoo 

or 

sudo su restart

Step 4: Confirm the Custom Addons Path

To make sure Odoo knows of your customized addons path use the Apps menu. This is in your Odoo instance. Press on "Update Apps List". Ensure that any modules located in custom directory are visible.

Adding Custom Addons Path via Command Line (Alternative Method)

There is one more approach to define custom addons path. This involves including it in Odoo command as argument. An example would be:

command

./odoo-bin -c /etc/odoo/odoo.conf --addons-path=/opt/odoo/addons,/opt/odoo/custom_addons

To gain clarity establish separate custom directories for development and production environments if there is need. It eases the subsequent maintenance and upgrades when you structure the custom addons directory by project. Similarly by feature. Employ version control similar to Git for changes. It prevents issues in the module updates.

Reasoning Behind a Custom Addons Path

Odoo houses all modules within the addons directory. However solely using the default path can introduce development challenges. This is particularly true when numerous custom modules are involved. A custom addons path lets you partition your custom modules from Odoo’s core modules. This structure maintains your development environment in an organized state. It simplifies module updates. It also safeguards against inadvertent overwrites or dilemmas.

Conclusion

Employing a custom addons path in Odoo is a beneficial technique. It suits any developer or business that uses custom modules. The setup improves code organization. It simplifies updates. It keeps the Odoo environment structured. By adhering to these steps, you can configure and manage a custom addons path. This can be done on your Odoo server.

Make a Comment

Your email address will not be published. Required fields are marked *