In this lesson, we will go through the steps of running Odoo (Community version) in Windows from the source code. Odoo is an open-source business management software suite that includes a range of business applications for various purposes such as accounting, inventory management, and customer relationship management (CRM). We will be using the PyCharm IDE. To run Odoo in other operating systems, please check the documentation here.
Prerequisite
- Must have Python (version 3.10 or later) installed
- Must have PyCharm Community Edition installed
- Must have Git installed
- Must have PostgreSQL (version 12.0 or later) installed
Add PostgreSQL’s bin directory to the Environment variables
- Launch Control Panel
- Click System and Security
- Click System
- Click Advance System Settings
- Click Environment Variables...
- If you want to make this path available to you alone, click New... under User variables. If you want to make this path available to everyone, click New... under System variables
- Variable name is Path and Variable value is the PostgreSQL’s bin directory (by default: C:\Program Files\PostgreSQL<version>\bin) (Note: If this variable already exists, click Edit... instead of New...)
Create a new PostgreSQL user
Open the pg admin gui (pgAdmin 4). Enter master password or click Reset Master Password if you forgot the password.
Enter password for postgres user. This is usually password.
Navigate to Login/Group Roles. Right click and select Create->Login/Group Role.
In the General tab, give the role a Name. In this example Name is odoo_user. (Remember this)
In the Definition tab, fill out the Password field. (Remember this)
In the Privileges tab, enable Can login? and Create databases?. Click Save.
Setting up project folder
Create a folder called Odoo Project (you can give this folder any name)
Inside this folder create a folder called config and another folder called custom_addons.
Inside the config folder, create a file called odoo.conf.
Open a command terminal and navigate to Odoo Project folder.
In the Odoo Project directory, clone the Odoo source code Git repository with the following command.
git clone https://github.com/odoo/odoo.git
At this point, your folder structure should look like this.
Odoo Project/
├─ config/
│ ├─ odoo.conf
├─ custom_addons/
├─ odoo/
Copy the requirements.txt in odoo folder and paste in the Odoo Project folder.
Setting up Pycharm
Open PyCharm and click New Project.
Select the location of your project. Check the option New environment using Virtualenv. You can leave the location of the environment as it is. Select the location of python.exe for the Base interpreter. Click Create.
We need to give Odoo our database information: user, password, host and port. The db_user and db_password created earlier (Create a new PostgreSQL user section). We also need to give Odoo the location of our custom_addons folder (addons_path).
On the Project Panel, open the odoo.conf file and copy the contents below.
[options]
addons_path = G:\Projects\Odoo\Odoo Project\custom_addons
db_user = odoo_user
db_password = odoo_user
db_host = localhost
db_port = 5432
Click File->Run->Edit Configurations.
Click Add new run configuration...
Click Python
Set the Name to Odoo. Set Script Path to the odoo-bin file. This is located inside the odoo folder which is inside the Odoo Project folder. Set Parameters to -c config/odoo.conf. Set Working Directory to the Odoo Project folder. Click Apply and OK.
Click Terminal at the bottom left.
Install the dependencies using the following commands.
pip install setuptools wheel
pip install -r requirements.txt
Click the Run Odoo button at the top.
In a browser go to http://localhost:8069. Enter Database Name, Email and Password.
Log in using your credentials.
You will now be logged in. Here you can activate your required applications.
This concludes our lesson. For more information, check the documentation here.
Top comments (0)