Setting up a development environment for odoo using pycharm is highly preferred by odoo developers to develop and debug odoo modules and other related functionalities .
Size: 2.66 MB
Language: en
Added: May 08, 2024
Slides: 36 pages
Slide Content
How to setup Pycharm environment for Odoo 17 Enterprise
Introduction Enterprise Setting up a development environment for odoo using pycharm is highly preferred by odoo developers to develop and debug odoo modules and other related functionalities .
Steps Enterprise Install Python 3.10: The most recent Python 3.10 version is not accessible in Ubuntu's default repository. As a result, we must add another repository. Python Packages may be found in the deadsnakes repository on launchpad.
Steps Enterprise Using the commands below, add the deadsnakes repository. sudo add-apt-repository ppa:deadsnakes/ppa sudo apt-get update
Steps Enterprise Using this command, you may check the updated Python package list. apt list | grep python3.10 Python 3.10 can be installed using the following command: sudo apt-get install python3.10 The following code may be used to install the required packages for Python3: 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
Steps Enterprise Install web dependencies: Installing the web dependencies is the next step. 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
Steps Enterprise Install the wkhtmltopdf: If you want to publish Odoo reports, you must install Wkhtmltopdf, which can be done with 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
Steps Enterprise Install PostgreSQL Next, we must install PostgreSQL: sudo apt install postgresql postgresql-client
Steps Enterprise Configure a Database User Role for Odoo Databases. Create a database user with the following instructions, and specify a password for the separate user because it will be required when creating the conf file, so save it. sudo su - postgres createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo17
Steps Enterprise Set the specified user as the superuser. psql ALTER USER odoo17 WITH SUPERUSER; Exit from both psql and the Postgres user. \q Exit
Steps Enterprise Get Odoo 17 Source Code Odoo 17 Community Source code may be obtained straight from Odoo's Github source. Otherwise, you may clone it from git. Install git and then run the following commands: sudo apt-get install git
Steps Enterprise The command below will clone the Odoo code into the Odoo17 directory within your home directory. git clone https://www.github.com/odoo/odoo --depth 1 --branch 17.0 --single-branch odoo17
Steps Enterprise Open the Odoo project in Pycharm Open Pycharm Community and navigate to the Odoo17 directory. After the project is open, a dialogue box similar to the one seen in the picture below may appear. This is used to build a virtual environment; however, we will construct a virtual environment via the terminal, so cancel it.
Steps Enterprise
Steps Enterprise To open the terminal, click on the icon shown below or use the command Alt+F12.
Steps Enterprise Then, use the commands below to create a venv with Python 3.10. curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10 sudo apt install python3.10-venv python3.10 -m venv your_venv_name
Steps Enterprise
Steps Enterprise You will be able to observe that your virtual environment has been enabled after closing and reopening the terminal; you will see the indicator in the terminal as shown below with your venv name.
Steps Enterprise If this does not activate your venv, use the following command. source your_venv_name/bin/activate
Steps Enterprise Install the required Python packages Odoo requires the installation of various Python packages, which are stated in the file requirement.txt within the Odoo17 directory. As a result, run this command in the terminal. pip install -r requirements.txt
Steps Enterprise In case you don't find any errors, you can use the command below to test whether all of the requirements stated in requirements.txt have been installed pip list
Steps Enterprise If you run into any errors, go to the requirements.txt file and install each requirement one by one with the command below. pip install requirement_name
Steps Enterprise In most cases, when installing packages that are specified twice, only one of them should be installed. So, even if one of them fails to install, it should not be a problem. Also, if some prerequisites defined with sys_platform as 'win32' fail to install, do not install them. If any errors occur during installing the package "psycopg2==2.9.2 ; sys_platform != 'win32' and python_version <= '3.10' or psycopg2==2.9.5 ; python_version > '3.10' or sys_platform == 'win32'" instead, use the command below to install another package. pip install psycopg2-binary
Steps Enterprise Create the odoo.conf file within the Odoo17 directory You can create conf file by right-clicking the directory and select New -> File -> odoo.conf After inserting the following block into the file odoo.conf, you should update the db_password, which is the password you specified for the database user Odoo17 in the previous stage.
Steps Enterprise Also, replace the addons_path value using the real path to the Odoo17 addons directory. You may accomplish this by pressing Ctrl + Shift + C in the addons directory. You will then be given the path to the current directory. Replace it in the addons_path. You may also create a new directory to include your custom modules; the path to that directory must be supplied in the addons_path, separated by commas. eg: addons_path = /home/user/odoo/addons, /home/user/odoo/custom_addons
Steps Enterprise Add Python Interpreter Go to Settings -> Project: odoo17 -> Python Interpreter to configure a Python interpreter.
Enterprise
Steps Enterprise When you open the aforementioned window, if the interpreter (python 3.10 from Odoo17 venv) is already set up, you don't need to make any changes. Otherwise, select the Add Interpreter option and make the following selections.
Steps Enterprise When the dialogue box below shows up, click the "+" button and select "Python" from the list. After that, you may fill in the fields as seen in the picture below.
Steps Enterprise
Steps Enterprise Name: You are free to give the configuration any name. Python Interpreter: This project's Python Interpreter needs to be included here. Because we had set the interpreter in the previous stage, it will fill in automatically. Script Path: Choose the "odoo-bin" file from the directory odoo17. Parameters: You can add parameters here to run with the script; the parameter -c is necessary, and you can add additional ones. You can also need to add the conf file in the parameter. Working location: You must include the location for the project's current working folder here.
Steps Enterprise Step 13: Test Run Odoo 17 Odoo's setup is finished. You may now try it by clicking the button below to launch the project.
Steps Enterprise
Steps Enterprise You may now test localhost:8017 in your browser. The browser will open the Odoo database management, as seen below if all of your settings are successful.
For More Info. Check our company website for related blogs and Odoo book. Check our YouTube channel for functional and technical videos in Odoo. Enterprise www.cybrosys.com