Skip to main content

How to Setup Development Environment to Customize Odoo Community

This article guides you through setting up the developer environment to customize the Odoo Community edition.

Step 1: Install Dependencies

Odoo requires certain dependencies to function correctly. Run the following command to install them:

sudo apt install git python3-pip build-essential wget python3-dev python3-venv python3-wheel libfreetype6-dev libxml2-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less libjpeg-dev zlib1g-dev libpq-dev libxslt1-dev libldb-dev libldap2-dev libtirpc-dev

Wkhtmltopdf is a dependency for generating PDF reports in Odoo. Download and install it using these commands:

wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb

sudo apt install ./wkhtmltox_0.12.5-1.bionic_amd64.deb

Step 2: Install PostgreSQL

Odoo uses PostgreSQL as its database management system. Install PostgreSQL with this command:

sudo apt install postgresql

After installation, create a new PostgreSQL user for Odoo:

sudo su - postgres -c "createuser --createdb --username postgres --superuser --pwprompt odoo"

Enter the PostgreSQL user password when prompted (in this case, I am using 'odoo').

Step 3: Download Odoo Source Code

You can download Odoo 16 Community Source code directly from Odoo’s Github repository or Odoo Github. Otherwise, you can clone it from git. For that, you have to install git, and follow the commands below:

git clone https://github.com/odoo/odoo.git --depth 1 --branch 16.0

Step 4: Install the required Python packages

Odoo required some Python packages to be installed, which are listed in the file requirement.txt inside the Odoo16 directory.

cd odoo

sudo pip install wheel

sudo pip install -r requirements.txt

If you are using Python 3.8 and below, do install the following packages:

sudo pip install Jinja2==2.10.1

sudo pip install MarkupSafe==0.23

Proper Installation of all the elements should be done. Otherwise, you may get errors in the future while functioning with Odoo.

Step 6: Install Pycharm IDE

The three editions of Pycharm are Education, Community, and Enterprise. The Pycharm Community edition will be installed here, and in order to operate Pycharm, your computer must meet a few minimum requirements.

The required configuration to install Pycharm on your PC described at Jetbrains official website.

To install Pycharm either you can directly download the Debian installation file from the Jetbrains website; OR

you can install the Pycharm by executing the following command from your Linux's terminal:

sudo snap install pycharm-community --classic

Step 7: Open the Odoo project in Pycharm

Open PyCharm Community using pycharm-community command and navigate to the Odoo directory.

After the project has loaded, a dialogue box like the one in the screenshot below might display. You can choose OK if you want to use a virtual environment, but we are not doing so at this time. Cancel it, then.

Note: Virtual environment is a tool to create isolated Python environments. It creates a folder which contains all the necessary executables to use the packages that a Python project would need.

Python3.10 interpreter is supported by Ubuntu 22.04 by default, but Python 3.8 is also available.

Step 8: Create odoo.conf File inside Odoo Directory

Navigate to your Odoo directory using the terminal, then:

sudo touch odoo.conf

sudo nano odoo.conf

Copy and paste the following configuration settings into the odoo.conf file:

[options]
; This is the password that allows database operations:
admin_passwd = admin
db_host = localhost
db_port = 5432
db_user = odoo
db_password = odoo
addons_path = (your_Odoo_directory_path)/addons
xmlrpc_port = 8016

You should update the db_password (which is the password you set for the database user Odoo in the previous stage), and replace your_strong_admin_password with a secure password of your choice. Save the file and exit by pressing Ctrl + X, followed by Y and Enter.

Step 9: Add Python Interpreter

Back to Pycharm, go to File > Settings > Under Project: odoo > Python Interpreter > Add Interpreter > Add Local Interpreter > System Interpreter, choose Python 3.8

Step 10: Add Project configuration in Pycharm

On the right top corner, click on Current File > Edit Configurations

Click the “+” button when the following dialogue box appears, and then choose “Python” from the list. The fields can then be filled up as indicated in the screenshot below.

Name: you can provide any name to identify the configuration.

Script Path: Select file ‘odoo-bin’ file from the Odoo directory.

Parameters: Here, you can add the parameters to run along with the script, -c is the required parameter and provide a conf file along with it and multiple parameters can be added.

Python Interpreter: Python Interpreter of this project should be added here. It will automatically fill there because we already set the interpreter in the previous step.

Step 11: Test Run Odoo

The configuration of Odoo is completed. Now you can test it by running the project by clicking the button below.

Now you can try it on your browser and check localhost:8016

If all your configuration was successful, the browser will navigate to the database manager of Odoo as shown below:

Comments

Popular posts from this blog

How to Install Odoo Community Edition in Ubuntu

This beginner-friendly, step-by-step guide is designed to help you install Odoo 16 on Ubuntu 20.04, even if you're new to the Unix command line. Follow the steps below to successfully install Odoo 16 and enhance your business management experience. Step 1: Open the Terminal To begin, you need to access the command line interface in Ubuntu. Press Ctrl + Alt + T to open the Terminal application. Step 2: Update Your System First, update your system packages to ensure you're working with the latest versions. Type the following command and press Enter: sudo apt update && sudo apt upgrade Enter your password when prompted, and wait for the update process to complete. Step 3: Install Dependencies Odoo requires certain dependencies to function correctly. Run the following command to install them: sudo apt install git python3-pip build-essential wget python3-dev python3-venv python3-wheel libfreetype6-dev libxml2-dev libzip-dev libldap2-dev libsasl2-dev python3-set