How to configure odoo 16 in pycharm A step-by-step Guide
Odoo 16 is the latest version of this powerful business management software. It offers a wide range of functionalities and is considered one of the most advanced versions available. In this tutorial, we will guide you through setting up a development environment for Odoo 16 using the PyCharm IDE on Ubuntu 22.04.
Step 1: Install PyCharm IDE
Before we begin, ensure that your computer meets the minimum requirements for PyCharm:
Minimum Requirements:
- Operating System: 64-bit Linux distribution (supporting Gnome, KDE, or Unity DE), Microsoft Windows 8 or later, or macOS 10.13 or later.
- RAM: 4 GB of free RAM (8 GB recommended).
- Disk Space: 2.5 GB (plus 1 GB for caches) on an SSD drive with at least 5 GB of free space.
To install PyCharm, you can either download the Debian installation file from the official website or use terminal commands:
sudo apt-get update
sudo apt-get upgrade
sudo snap install pycharm-community --classic
Step 2: Install Python 3 and Necessary Packages
Install Python 3 and the required development packages:
sudo apt install python3-pip
sudo apt-get install python-dev 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
Install 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 wkhtmltopdf
If you need to publish reports in Odoo, you must install wkhtmltopdf:
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
Install PostgreSQL:
sudo apt-get install postgresql
Step 6: Create a Database User Role for Odoo
Create a user role for handling Odoo databases:
sudo su - postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo16
Make the user a superuser:
psql
ALTER USER odoo16 WITH SUPERUSER;
\q
exit
Step 7: Download Odoo 16 Source Code
Clone the Odoo 16 Community Source code from the GitHub repository:
sudo apt-get install git
git clone https://www.github.com/odoo/odoo --depth 1 --branch 16.0 --single-branch odoo16
Step 8: Install Required Python Packages
Navigate to the Odoo 16 directory and install the required Python packages listed in requirements.txt
:
cd odoo16
sudo pip3 install -r requirements.txt
Step 9: Open the Odoo Project in PyCharm
Launch PyCharm Community and open the odoo16
directory.
Step 10: Create an odoo.conf
File
Create an odoo.conf
file in the odoo16
directory and add the following configuration, replacing db_password
with the password you set for the database user odoo16
:
[options]
admin_passwd = admin
db_host = localhost
db_port = 5432
db_user = odoo16
db_password = False
addons_path = /home/user/odoo/addons
xmlrpc_port = 8016
Step 11: Add Python Interpreter
Configure the Python interpreter for your project, choosing Python 3.10 or Python 3.8, which are both supported on Ubuntu 22.04.
Step 12: Add Project Configuration in PyCharm
Go to File > Edit Configurations
and create a new Python configuration:
- Name: Provide a name for the configuration.
- Script Path: Select the
odoo-bin
file in theodoo16
directory. - Parameters: Add the parameters you need to run, including
-c
followed by the path to yourodoo.conf
file. - Python Interpreter: Select the Python interpreter for the project.
Step 13: Test Run Odoo 16
You’ve completed the Odoo configuration. Now, test it by running the project in PyCharm. Open your browser and check localhost:8016
. If everything was set up correctly, you’ll see the Odoo database manager.
That’s it! You now have a fully functional Odoo 16 development environment with PyCharm on Ubuntu 22.04. Happy coding!