Introduction
Odoo is a powerful and versatile open-source business application suite that includes a wide range of modules for various business needs, such as CRM, accounting, inventory, and more. If you’re a developer working on a Mac and prefer using PyCharm as your Integrated Development Environment (IDE), this guide will walk you through the process of installing Odoo on your Mac OS using PyCharm.
Prerequisites
Python 3.7 or later (Preferably 3.8) — https://www.python.org/downloads/
PyCharm IDE — https://www.jetbrains.com/pycharm/download/?section=mac
PostgreSQL 10 or later (Preferably v13) — https://www.postgresql.org/download/
PGAdmin 4 — https://www.pgadmin.org/
Build Tools for Studio for Windows (I use MacOS in this tutorial) — https://visualstudio.microsoft.com/do...
NodeJS — https://nodejs.org/en/download/
The Process
Install Homebrew. Homebrew is a package manager for Mac that will make the installation process much smoother. Open your terminal and execute the following command to install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install git using brew
brew install git
Install NodeJS
npm install -g npm
Install python, pycharm, postgreSQL, PGAdmin4 and visual studio by following the above link to continue the process below.
Using your preferred location, create the folder for your odoo community. Now let say you have a directory “/Users/username/Documents/odoo/v15/odoo-server”. Please note that username will be your Mac username. Open your terminal and go inside the above directory by using terminal. Clone the odoo v15 repository by following the the command below:
git clone https://www.github.com/odoo/odoo --depth 1 --branch 15.0.
It is advisable to use virtual environment so that python module packages will not mix with other Odoo instances or python versions. To create virtual environment, first go to “/Users/username/Documents/odoo/v15” in your terminal and run the following command:
python3 -m venv odoo_venv
After the above command, your v15 folder should be as follows:
Since we will be using pycharm, ensure that postgreSQL is running
For security reason, we will not be able to use default postgres user. To create a new user, open pgAdmin 4. For first time use, it will ask for password.
Go to Servers - Localhost and right click Login/Group Roles and select Create - Login/Group Role…
In General, type name and add password in definition. Lastly, under privileges, toggle Can Login and Create Databases. Click Save.
Now, create a new folder under "Users/username/Documents/v15" and name it tutorial_theme. Open tutorial_theme with pycharm.
By default, PyCharm will create a new file main.py but delete it. Inside tutorial_theme folder, create Odoo configuration by creating a new file called odoo.conf. Add the following code to the odoo.conf file in pycharm:
[options]
admin_passwd = 1
db_host = False
db_port = False
db_user = trial
db_password = trail
dbfilter = ^tutorial_theme.*$
db_list = True
addons_path = /Users/username/Documents/odoo/v15/odoo-server/addons
http_port = 8069
Add virtual environment by going in PyCharm - Preferences - Project - Python Interpreter. Check the link of the current python interpreter you created under "Users/username/Documents/odoo/v15/odoo_venv, then click gear icon on the right side and click add to add it.
Select Existing Environment and locate python3 file which is located inside "odoo_venv/bin/python3". Click apply and okay button.
Edit the PyCharm configuration by clicking on the menu bar. By default, it creates a new configuration "main". Click main and click the minus (-) button on top left to delete it.
Click on the plus (+) button to add new and choose Python. Copy the code below for the script path and parameters. Please replace the code based on the location of your file. Click apply and OK.
Script Path: /Users/username/Documents/odoo/v15/odoo-server/odoo-bin
Parameters: -c "/Users/username/Documents/odoo/v15/tutorial_theme/odoo.conf"
Run Odoo by clicking green arrow in the toolbar.
Go to the browser on type the url http://localhost:8069. You will be redirected to http://localhost:8069/web/database/manager since there are no database created.
If you face the bug below:
Undertake the following action to fix the problem:
Re-run odoo from pycharm and go back to the browser to type the url http://localhost:8069.
This should work perfectly!!!
You just installed odoo on MacBook silicon valley chip using pycharm!!!
Top comments (0)