Andrius
Andrius

Reputation: 21118

Odoo specify addons paths as a pattern?

Is it possible to specify odoo addons paths as a pattern?

I have a directory where I keep modules separated by projects, like this:

~/source/:
  project1/
    /module1
    /module2
  project2/
    /module3
    /module4

And so on. Now if I want to specify all my modules paths, I need to manually specify every project directory as addons path. And if there gonna be new projects, I will need to update the path.

But if I could specify something like:

--addons-path=~/source/*/, so it would load all projects as addons path, it would work way more dynamically. But doing this, just gives me error that there is no such directory.

Upvotes: 2

Views: 403

Answers (1)

ea-
ea-

Reputation: 356

Odoo doesn't allow this kind of wildcard syntax.

This configuration is a simple split on comma with only a replacement of home directory (~ on unix) and environment variables.

You could use a shell or bash script to do this, for example in a linux shell you could use when starting odoo by command line:

--addons-path=$(echo ~/source/* | tr ' ' ,)

the tr ' ' , command is used to replace the spaces introduce by the wildcards by comma which is the path separator expected by odoo.

Upvotes: 1

Related Questions