indaclouds.fr

Some tips when I take time to write them down.

Build Odoo addons path quickly


EDIT: Better way to add OCA modules to an Odoo installation

When you have a lot of Odoo modules you want to work with, you have to add their parents folders in the addons path to allow Odoo knows about them.

This is what my addons folder looks like:

% tree -L 1
.
├── account-analytic
├── account-consolidation
├── account-financial-tools
├── account-fiscal-rule
├── account-invoice-reporting
├── account-invoicing
├── addons-vauxoo
├── bank-payment
├── bank-statement-import
├── bank-statement-reconcile
├── community-data-files
├── crm
├── geospatial
├── knowledge
├── l10n-france
├── multi-company
├── odoo-connector-gitlab
├── partner-contact
├── pos
├── product-attribute
├── product-variant
├── report-print-send
├── reporting-engine
├── sale-financial
├── sale-reporting
├── sale-workflow
├── server-tools
├── social
├── survey
├── web
└── website

Each folder is a collection of odoo modules. Write an addon path for this can be painful so I searched how to do this with the command line and this what I found.

ls -d $PWD/*/ | tr "\\n" "," | sed 's/\(.*\),/\1/'

The command as three parts:

  1. ls -d $PWD/*/ list only directories from the current directory.
  2. | tr "\\n" "," take the output of 1 and replace the line feed by a comma.
  3. | sed 's/\(.*\),/\1/' take the output of 2 and remove the trailing comma at the end.

Now you can just paste the output of this command to the end of your addons path in your config file or directly pass it to the command line.