Skip to content

2. How to use

Florian Daloze edited this page Sep 2, 2025 · 2 revisions

OdooLS is a language server. You can use it in an IDE or as a CLI tool. Let's explore both ways

Use OdooLS in your IDE

By implementing the LSP protocol, OdooLS can easily be included in your IDE if this one supports it.

We already implemented some integrations. Follow the links to know more about it, how to install and use it:

If you are interested by an integration in another IDE, do not hesitate to suggest it to us by opening an issue. You can try to implement yourself too by following this guide

Setup your extension

Check the wiki related to your IDE:

Use OdooLS as a CLI

Even if OdooLS is designed to work in real time on your project, you can use it too as a static tool and run it to get diagnostics on your code.

To use it as a CLI, be sure first to have a valid environment.

Setup

To run properly, you need the executable (odoo_ls_server or odoo_ls_server.exe).

Next to it, you must have the typeshed directory. You already downloaded it if you built it from sources (in repository/server/typeshed). If not, clone the repository next to your executable.

That's enough to run OdooLS, but now you'll need to provide project information

Usage

Basically, you have to run

./odoo_ls_server --parse

to run server in one-shot mode. The server will load your project and output all diagnostics to a json file.

However, you'll need to give some information about your project:

The path to your Odoo folder: -c /path/to/odoo

The additional addons you want to include: -a /path/to/addons_folder_1 -a /path/to/addons_folder_2 Do not include each module separatively, but as you would do in odoo command line, with the folder containing all your modules.

You can specify the output file name with -o output.json

The option --tracked-folders /your/folder can be used to filter outputs. When using this parameter, only diagnostics emitted from this directory will be in the resulting json file.

If your installation of typeshed is not next to your executable or if you want to change provided stubs, you can use -s /path_to_typeshed/stubs. You will have to provide the path to the different stdlib too with --stdlib path_to_typeshed/stdlib If you don't want to use typeshed stubs (but stdlib is mandatory), you can use --no-typeshed-stubs. OdooLS will then try to read sources from installed packages directly instead of stubs (Not really recommended)

A full command could then look like this:

./odoo_ls_server --parse -c /data/sources/odoo -a /data/sources/enterprise -a /data/build/design-themes -o /data/output/odoo_lint.json -s /data/build/typeshed/stubs -s /data/sources/odoo-ls/server/additional_stubs --tracked-folders /data/sources/enterprise --stdlib /data/build/typeshed/stdlib

It will then output all diagnostics about enterprise folder in /data/output/odoo_lint.json

You can use the option --help to get more information about other available parameters.

Clone this wiki locally