Skip to content

Configuration files

Florian Daloze edited this page Jun 16, 2025 · 1 revision

OdooLS is using (since 0.8.0) configuration files to detect your odoo setup and use right configuration variables according to your needs. This allow us way more flexibility than settings.json files from VsCode, and make them valid for any EDI, so they are sharable too. We wanted something that can be highly customizable, but easy to use. So depending to your needs, you'll find here 3 ways to use OdooLS configuration files:

No configuration file

That's right! OdooLS can now work without any configuration files. By default, when you open a workspace, it will try to search for an Odoo directory, and check if addons directories exists. If yes, an 'automatic' setup is used, using this odoo and these addons paths.

Basic configuration file

The first option has of course some limitations: what if you only open an addons directory? Or if you want to change python environment? If the default behaviour do not fit your needs, you can create a configuration file, named odools.toml in your filesystem. Let's create it at the root folder of your current workspace for now. We will discuss about configuration files location later (insert link) The content of the configuration file is following the TOML syntax. Here is a valid content of a configuration file:

[[config]]
name = "My Config"
odoo_path = "/home/odoo/community"

This configuration file, if found at the root of your workspace, will indicate to OdooLS that it should use the Odoo sources located at /home/odoo/community, even if another odoo is opened in vscode. We can add addons paths too:

addons_paths = ["/home/odoo/enterprise"]

or even use dynamic paths:

addons_paths = ["${workspaceFolder}"]

In this file, you can setup any setting of OdooLS. Here is a list of valid values:

Key Type / Values Description Default
name string Name of the configuration profile "root"
extends string (optional) Name of another profile in the same file to extend from
odoo_path string (optional) Path to the Odoo source code
addons_paths array of string List of addon directories to include
addons_merge "merge" | "override" How to combine addons_paths with parent profile "merge"
python_path string (optional) Path to the Python interpreter
additional_stubs array of string Additional stub directories
additional_stubs_merge "merge" | "override" How to combine additional_stubs with parent profile "merge"
refresh_mode "onSave" | "adaptive" | "off" When to refresh the server data "adaptive"
file_cache bool Enable file caching for workspace files true
diag_missing_imports "all" | "only_odoo" | "none" Diagnostics for missing imports "all"
ac_filter_model_names bool Only show model names from module dependencies in autocompletion true
auto_save_delay integer (min: 1000, max: 15000) Delay in ms before refreshing after an update (values outside this range will be clamped) 1000
add_workspace_addon_path bool Add the workspace folder as an addon path if it looks like one and you specified other addons paths false

When setting paths, you can use dynamic variables too: ${userHome}, ${workspaceFolder} or more specifically ${workspaceFolder:FOLDERNAME}

Advanced usage: multiple configuration files and profiles

This section will explain how to create and combine multiple configuration files and profiles.

Configuration files priority

To load configuration files, OdooLS will follow this sequence for each workspace folder:

  • load configuration file in the folder
  • search for another configuration file one folder above and load not already set variables

This allow you to create generic configuration file at a top level, like /home directory, and change various settings in some projects. But you can go further by using profiles:

Using profiles

When you write your configuration file, you can give a name to your set of variables. This will create a 'profile' that can be used in OdooLS. When opening your workspaces, if OdooLS find multiple profiles, you will be able to easily switch from one to another (see LINK on how to change your current profile according to your EDI) You can extend a profile too by using the keyword 'extends' followed by the name of a profile to indicate your are using this profile as a base for yours.

A complete example

Now that most of the features of configuration files has been explained, let's demonstrate the usage through an example.

File structure

The filesystem is filled with these files:

📁home/user/
├── 📄odools.toml
├── 📁community/
│   ├── 📄odools.toml
│   └── 📁other_odoo_files
└── 📁my_addons/
    ├── 📄odools.toml
    ├── 📁project_a
    |   └── 📁custom_module_1
    └── 📁project_b
        └── 📁custom_module_2

/home/user/odools.toml

[[config]]
name = "base_setup"
file_cache = false

/home/user/community/odools.toml

/home/user/my_addons/odools.toml

Clone this wiki locally