Odoo 16 Development Environment Using Pycharm in Ubuntu 22.04
Since Ubuntu 22.04 is a Long-Term Support (LTS) edition, it will continue to get important security patches and software upgrades for five years after its first release. Every six months, software updates with new Linux kernel releases and graphics driver updates are also released.
This article will explain how to set up an Odoo 16 development environment in Ubuntu 22.04 using the Pycharm IDE.
Therefore, in order to run Odoo, we must first install the necessary libraries and packages.
before setting up Pycharm. Let's examine that step-by-step.
Install the Pycharm IDE first
Pycharm has three editions: Community, Education, and Enterprise. Here, the Pycharm Community version will be installed. Your machine must meet a few prerequisites in order for Pycharm to function.
the setup needed to install Pycharm on your computer.
|Operating System||64-bit Linux distribution that works with Microsoft Windows 8 or later, macOS 10.13 or later, and Gnome, KDE, or Unity DE||newest 64-bit variation of|
|RAM||$ GB of free RAM||8 GB of total system RAM|
|Disk Space||2.5 GB, and an additional 1 GB for caching||at least 5 GB of empty space on an SSD disc|
You can either directly download the Debian installation file from the following URL to install Pycharm. Take the Pycharm download.
Alternatively, you can install Pycharm by running the instructions.
To do that, use Terminal (Ctrl + Alt + T) and enter the following commands:
sudo apt-get update sudo apt-get upgrade sudo snap install pycharm-community --classic
Install Python 3 and the required packages in Step 2:
The following command can be used to install Python 3:
sudo apt install python3-pip
The following code can be used to install the required packages for Python 3:
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
Install web dependencies in step three:
The web requirements must then be installed.
sudo apt-get install -y npmsudo ln -s /usr/bin/nodejs/usr/bin/node sudo npm install -g less less-plugin-clean-css sudo apt-get install -y node-les
Step 4: Set up the wkhtmltopdf program.
If you want to publish reports made in Odoo, you must install Wkhtmltopdf. You may do this by 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
After that, we must set up PostgreSQL:
Create a database user role for managing Odoo databases in step six.
The distinctive user's password must then be specified because it will subsequently be needed in the conf file.
sudo su - postgrescreateuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo16
Make the defined user a superuser
ALTER USER Odoo16 WITH SUPERUSER;
And Exit from psql and also from Postgres user
Step 7: Download the source code for Odoo 16
From the Odoo Github repository or Odoo Github, you can immediately download the Odoo 16 Community Source code. The alternative is to clone it from git. Install Git for that, then execute the steps listed below:
sudo apt-get install git
The Odoo source will be copied into your home directory's Odoo16 directory with the following command.
git clone https://www.github.com/odoo/odoo --depth 1 --branch 16.0 --single-branch odoo16
Install the necessary Python packages in step eight.
The file requirement.txt located in the Odoo16 directory contains a list of the Python packages that Odoo requires to be installed.
cd odoo16 sudo pip3 install -r requirements.txt
sudo pip3 install -r <path to inside odoo directory>/requirements.txt
All of the components should be installed properly. Otherwise, working with Odoo can cause errors in the future.
Step 9: Launch Pycharm and the Odoo project
Open the Odoo16 directory in Odoo and Pycharm Community.
A dialogue box similar to the one in the screenshot below might appear after the project has loaded. If you wish to use a virtual environment, you can select OK, but we aren't doing it right now. Then cancel it.
Although Python 3.8 is also available, Ubuntu 22.04 by default supports the Python 3.10 interpreter.
Create the Odoo.conf file in the Odoo16 directory in step 10
New -> File -> Directory -> Right-click -> odoo.conf
After pasting the following block into the file odoo.conf, you should update the db_password, which is the password you set for the database user Odoo16 in the prior step.
[options]; Does This Password Permit Database Operations?:admin_passwd = admindb_host = localhostdb_port = 5432db_user = odoo16db_password = Falseaddons_path = /home/user/odoo/addonsxmlrpc_port = 8016
Additionally, replace the value for addons_path with the actual path to the addons directory within Odoo16.
Use Ctrl + Shift + C on the addons directory to accomplish it. You will then receive a response with the path to the current directory. Replace it in the addons_path. Alternatively, you can create a separate directory for your custom modules and enter the path to it in the addons_path, separated by commas.
Take the following example: addons_path = /home/user/odoo/addons, /home/user/odoo/custom_addons
Add the Python interpreter in step 11
Navigate to File > Settings > ODOOO16 project: Python interpreter
By clicking the icon that is shown in the screenshot below, choose the Add option.
We must add an interpreter from the 'Add Interpreter' menu because there isn't any already in this screenshot.
Add Project configuration in Pycharm in step 12
Navigate to Current File. Edit Configuration
Click the "+" button when the following dialogue box appears, and then choose "Python" from the list.
The fields can then be filled out as shown in the following screenshot.
Name: You are free to give the configuration any name.
Path of the script: Choose the 'odoo-bin' file from the odoo15 directory.
-c is a mandatory argument, and you must also supply a conf file with it. Multiple parameters may be supplied. Parameters: The parameters for the script to run with can be added here.
Python Interpreter: This project's Python interpreter needs to be added. Because we had set the interpreter in the previous step, it will automatically fill there.
Test Odoo 16 in Step 13
Odoo's configuration is finished. The project can now be launched to test it out by clicking the button below.
You can now check localhost:8016 in your browser to give it a try.
If everything you configured works out, the browser will direct you to Odoo's database management as seen below:
This is how to set up a Odoo development environment on Ubuntu 22.04 using Pycharm.Request Your Free Quote