Enable Dark Mode!
how-to-setup-odoo-16-development-environment-using-pycharm-in-ubuntu-22-04.jpg
By: Nisiya K

How to Setup Odoo 16 Development Environment Using Pycharm in Ubuntu 22.04

Technical Odoo 16

Odoo 16, the recent version of Odoo, Version 16, offers the most functional options and is the most prominent and advanced version of the software for achieving the ultimate business management. Odoo 16 uses Python 3.8+ for backend development, PostgreSQL for the database server, and javascript frontend development.

Ubuntu 22.04 is a Long-Term Support (LTS) release and will receive ongoing app updates and critical security fixes for five years from release. New Linux kernel releases and graphics driver updates are also rolled out as software updates every six months.

In this blog, we will go over how to set up a development environment for Odoo 16 using Pycharm IDE in Ubuntu 22.04.

Therefore, we must first install some required libraries and packages to execute Odoo before configuring Pycharm. Let's take a step-by-step look at that.

Step 1: 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.


RequirementMinimumRecommended
Operating System64-bit of Linux distribution that supports Gnome, KDE, or Unity DE, Microsoft Windows 8 or later, and macOS 10.13 or laterThe latest 64-bit version of
RAM$ GB of free RAM8 GB of total system RAM
Disk Space

2.5 GB and another 1 GB for caches

SSD drive with at least 5 GB of free space

To install Pycharm either you can directly download the Debian installation file from the following link Download the Pycharm.

Or you can install the Pycharm by executing commands.

For that, open Terminal (Ctrl + Alt + T to open the terminal) and execute the following commands:

sudo apt-get update 
sudo apt-get upgrade
sudo snap install pycharm-community --classic

Step 2: Install Python3 and the necessary packages:

We can install Python3 using the following command:

sudo apt install python3-pip

The installation of the necessary packages for python3 can be done using the following code:

sudo apt-get install python3-dev build-essential libjpeg-dev libpq-dev libjpeg8-dev libxml2-dev libssl-dev libffi-dev libmysqlclient-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev liblcms2-dev 

Step 3: Install web dependencies

Next, we have to install the web dependencies:

sudo apt-get install -y npm
sudo ln -s /usr/bin/nodejs/usr/bin/node 
sudo npm install -g less less-plugin-clean-css 
sudo apt-get install -y node-less

Step 4: Install the wkhtmltopdf

Installing Wkhtmltopdf is required if you need to publish reports created in Odoo, and it can be done using the following code.

sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb 
sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb 
sudo apt install -f

Step 5: Install PostgreSQL

Next, we have to install PostgreSQL:

sudo apt-get install postgresql

Step 6: Create a Database User Role for Handling Odoo Databases

Next, It is necessary to specify a password for the distinctive user because it will be required later in the conf file.

sudo su - postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo16

Make the defined user a superuser

psql
ALTER USER odoo16 WITH SUPERUSER;

And Exit from psql and also from Postgres user

\q 
Exit

Step 7: Download Odoo 16 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:

sudo apt-get install git

The following command will clone the Odoo source into the Odoo16 directory inside your home directory

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

Step 8: 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 odoo16
sudo pip3 install -r requirements.txt

Or

sudo pip3 install -r <path to inside odoo directory>/requirements.txt

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

Step 9: Open the Odoo project in Pycharm

Open Pycharm Community and open Odoo16 directory

How to Setup Odoo 16 Development Environment Using Pycharm in Ubuntu 22.04-cybrosys

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.

How to Setup Odoo 16 Development Environment Using Pycharm in Ubuntu 22.04-cybrosys

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

Step 10: Create odoo.conf File inside Odoo16 Directory

Right-click on the directory -> New -> File -> odoo.conf

You should update the db_password, which is the password you set for the database user Odoo16 in the previous stage, after pasting the following block into the file odoo.conf.

[options]
; Is This The Password That Allows Database Operations:
admin_passwd = admin
db_host = localhost
db_port = 5432
db_user = odoo16
db_password = False
addons_path = /home/user/odoo/addons
xmlrpc_port = 8016
And also, change the addons_path value with the actual path of the addons directory inside Odoo16.
For that, you can use Ctrl + Shif + C on the addons directory. The path to the current directory will then be returned to you. In the addons_path, replace it. To add your custom modules, you can alternatively build a separate directory; the path to that directory must be provided in the addons_path, separated by commas. 
eg: addons_path = /home/user/odoo/addons, /home/user/odoo/custom_addons
Step 11: Add Python Interpreter
Go to File -> Settings -> Project: odoo16 -> Python Interpreter
Select the Add option by clicking the symbol that is displayed in the screenshot below.

How to Setup Odoo 16 Development Environment Using Pycharm in Ubuntu 22.04-cybrosys

Since there is no interpreter to add to this screenshot, we must do it from the 'Add Interpreter' menu. 

We have already covered the fact that Python 3.10 and Python 3.8 are both supported by Ubuntu 22.04. Therefore, set up the interpreter to use Python 3.10.

How to Setup Odoo 16 Development Environment Using Pycharm in Ubuntu 22.04-cybrosys

Step 12: Add Project configuration in Pycharm

Go to - Current File> Edit Configurations

How to Setup Odoo 16 Development Environment Using Pycharm in Ubuntu 22.04-cybrosys

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.

How to Setup Odoo 16 Development Environment Using Pycharm in Ubuntu 22.04-cybrosys

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

Script Path: Select file ‘odoo-bin’ file from odoo15 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 13: Test Run Odoo 16

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

How to Setup Odoo 16 Development Environment Using Pycharm in Ubuntu 22.04-cybrosys

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:

How to Setup Odoo 16 Development Environment Using Pycharm in Ubuntu 22.04-cybrosys

This is the way that you can set up a development environment using Pycharm in Ubuntu 22.04

Also check How to setup Odoo 17 Development Environment Using Pycharm & Have a look at the following blog to explore more about Install Odoo 16 on Ubuntu


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment

 


whatsapp
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

London

Cybrosys Limited
Alpha House,
100 Borough High Street, London,
SE1 1LB, United Kingdom

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message