Chapter 2: Development Environment Set-up
There are multiple ways to install Odoo depending on the intended use case.
This document attempts to describe the installation options for an internal Odoo R&D developer. We assume that you are installing your development environment on a standard Odoo laptop with Linux Mint installed and up-to-date. At the time of writing, we are using a vanilla Linux Mint 20 (Ubuntu 20.04) as a starting point.
If you are using another environment, you can refer to Source Install.
Fetch the sources & configure git
Install and configure git
The very first step of the installation process is to install the git version control system because the Odoo source code is managed on GitHub. Once installed, you can set your name and email:
To fetch the sources and contribute to Odoo’s development you will need a GitHub account. We recommend using your trigram (xyz) followed by ‘-odoo’ as your username: ‘xyz-odoo’. If you prefer, you can also use your personal GitHub account.
The easiest way to authenticate with GitHub is to use an SSH connection. Using the SSH authentication will allow you to connect to GitHub without supplying your username and password every time.
The following instructions are based on the official GitHub documentation.
Here is a step-by-step procedure:
Generate a new SSH key, add it to the ssh-agent and copy the SSH key to your clipboard.
In the upper-right corner of any page, click your profile photo, then click Settings
In the user settings sidebar, click SSH and GPG keys.
Click New SSH key or Add SSH key.
In the “Title” field, add a descriptive label for the new key.
Paste your key into the “Key” field.
Click Add SSH key.
Fetch the sources
All the Odoo sources will be located in
Configure development repository
If you are lucky enough to work at Odoo, the forks already exist. They are called
Useful git commands
Here are some useful git commands for your day-to-day work.
Change branch: When you change branches, both repositories (odoo and enterprise) must be synchronized, i.e. both need to be in the same branch.
Fetch and rebase:
Install the dependencies
Odoo requires Python 3.6 or later, if your computer is up-to-date you should already be at this version or higher.
You can check your Python version with:
Install pip3 and libraries
For libraries using native code, installation of development tools and native dependencies is required before installing the Python dependencies of Odoo.
Install odoo requirements
wkhtmltopdf is a library to render HTML into PDF. Odoo uses it to create PDF reports. wkhtmltopdf is not installed through pip and must be installed manually in version 0.12.5 to support headers and footers.
Right-to-left interface support
In order to support right-to-left (RTL) languages, we need
rtlcss to convert the CSS files:
As seen in Chapter 1: Architecture Overview, Odoo uses PostgreSQL as a RDBMS. In the context of a development machine, the easiest approach is to install it locally. Then we can create a PostgreSQL user corresponding to our current user:
Some useful SQL commands:
Run the server
Once all dependencies are set up, Odoo can be launched by running odoo-bin, the command-line interface of the server.
There are multiple command-line arguments that you can use to configure the server. In this training you will only need some of them.
The database that is going to be used.
A comma-separated list of directories in which modules are stored. These directories are scanned for modules.
Prevents the worker from using more than <limit> CPU seconds for each request.
Prevents the worker from taking longer than <limit> seconds to process a request.
The last two can be used to prevent the worker from being killed when debugging the source code.
Log in to Odoo
To log in as the administrator user, you can use the following credentials:
The developer mode
The Developer or Debug Mode gives you access to additional (advanced) tools.
This is useful for training and we assume that the user is in developer mode for the rest of the tutorials.
To activate the developer or debug mode you can follow the steps here.
For Python, we use PEP8 with these options ignored:
E501: line too long
E301: expected 1 blank line, found 0
E302: expected 2 blank lines, found 1
If you do not know how to set up a linter:
Here is an explanation of how to set up a Python linter in VSCode. There are multiple linter options you are free to choose from, but Flake8 is a popular choice.
To setup ESLint in VSCode, you must download the ESLint extension and follow its instructions for installing ESLint. Don’t forget to create and set up the
.eslintrcfile to follow the configuration file mentioned above.
Another useful VSCode plugin is Trailing Spaces to quickly notice trailing spaces while you’re working.
Administrator tools for PostgreSQL
To connect the GUI application to your database we recommend you connect using the Unix socket.
Host name/address = /var/run/postgresql
Port = 5432
Username = $USER
When facing a bug or trying to understand how the code works, simply printing things out can go a long way, but a proper debugger can save a lot of time.
You can use a classic Python library debugger (pdb, pudb or ipdb) or you can use your editor’s debugger. To avoid difficult configurations in the beginning, it is easier if you use a library debugger.
In the following example we use ipdb, but the process is similar with other libraries.
Install the library:
Here is a list of commands:
Without an argument, print the list of available commands. With a command as an argument, print help about that command.
The value of the
expressionis pretty-printed using the
Print a stack trace, with the most recent frame at the bottom.
Move the current frame one level down in the stack trace (to a newer frame).
Move the current frame one level up in the stack trace (to an older frame).
Continue the execution until the next line in the current function is reached or it returns.
Continue the execution and only stop when a breakpoint is encountered.
Execute the current line, stop at the first possible occasion (either in a function that is called or on the next line in the current function).
Quit the debugger. The program being executed is aborted.
Now that your server is running, it’s time to start writing your own application!