Lesson 1: Setting Up Odoo 17 (WSL2 + VS Code)

🚀 Lesson 1: Setting Up Your Odoo 19 Development Environment

Course: Odoo 19 Full-Stack Development Masterclass

Academy: OnecodeAi Academy

Tools: Windows 11 + WSL2 (Ubuntu) + VS Code + PostgreSQL 16

Target Odoo Version: Odoo 19.0 (Latest Release)

🎯 Lesson Objectives

By the end of this lesson, you will have a complete, high-performance Odoo 19 enterprise development environment running inside WSL2 Linux on Windows 11, with 1-click VS Code debugging enabled.

📋 Prerequisites

Before starting, ensure you have:

  1. A computer running Windows 11 (or Windows 10).
  2. VS Code installed on Windows with the WSL extension installed.

🛠️ Step-by-Step Installation Guide

Step 1: Install WSL2 (Windows Subsystem for Linux)

Open PowerShell as Administrator on Windows and run:

codePowershell

wsl --install

Note: Restart your computer after installation completes. When Linux opens upon reboot, set your preferred username and password.

Step 2: Update Ubuntu & Install Dependencies

Open VS Code, press Ctrl + Shift + P, select WSL: Connect to WSL, open the integrated terminal (Ctrl + ~), and run:

codeBash

# 1. Update Ubuntu packages
sudo apt update && sudo apt upgrade -y

# 2. Install Python 3, PostgreSQL, and C-libraries required by Odoo 19
sudo apt install python3-pip python3-dev python3-venv \
libxml2-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev \
build-essential libssl-dev libffi-dev libjpeg-dev libpq-dev \
git postgresql postgresql-contrib -y

Step 3: Clone Odoo 19 Core Source Code

In your WSL terminal, run the following commands to create your project directory and clone the official Odoo 19 repository:

codeBash

# 1. Create project workspace
mkdir -p ~/onecodeai_projects
cd ~/onecodeai_projects

# 2. Clone official Odoo 19 source code (Branch 19.0)
git clone https://www.github.com/odoo/odoo --depth 1 --branch 19.0 --single-branch odoo19

# 3. Create a Python Virtual Environment
python3 -m venv venv-odoo19

# 4. Activate the virtual environment
source venv-odoo19/bin/activate

# 5. Upgrade pip and install all Odoo 19 requirements
pip install --upgrade pip
pip install -r odoo19/requirements.txt

Step 4: Configure PostgreSQL Database Security

Run the following commands to start PostgreSQL and create the Odoo database superuser:

codeBash

# 1. Start PostgreSQL Service
sudo service postgresql start

# 2. Create the Odoo 19 database user
sudo -u postgres psql -c "CREATE USER odoo19_user WITH PASSWORD 'odoo19' SUPERUSER;" 2>/dev/null || sudo -u postgres psql -c "ALTER USER odoo19_user WITH PASSWORD 'odoo19' SUPERUSER;"

📄 Configuration Files Setup

File 1: odoo.conf

Create a new file named odoo.conf inside the odoo19 folder (~/onecodeai_projects/odoo19/odoo.conf) and paste the following content:

codeIni

[options]
; =====================================================================
; OnecodeAi Master Odoo 19 Configuration
; =====================================================================

; Addons Path
addons_path = ./addons,./odoo/addons

; Database Authentication (Forces TCP/IP)
db_host = 127.0.0.1
db_port = 5432
db_user = odoo19_user
db_password = odoo19

; Web Server Port
http_port = 8099

; Developer Tools (Auto-reload on Python/XML changes)
dev_mode = reload,xml

File 2: .vscode/launch.json (For 1-Click Debugging)

Create a folder named .vscode in your workspace root (~/onecodeai_projects/.vscode/) and add a file named launch.json:

codeJSON

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "🚀 Run Odoo 19 (OnecodeAi)",
            "type": "debugpy",
            "request": "launch",
            "program": "${workspaceFolder}/odoo19/odoo-bin",
            "args": [
                "-c",
                "${workspaceFolder}/odoo19/odoo.conf"
            ],
            "console": "integratedTerminal",
            "justMyCode": false
        }
    ]
}

🧪 Testing Your Environment

  1. Ensure PostgreSQL is running:codeBash
    sudo service postgresql start
  2. Press F5 in VS Code (or run python3 odoo19/odoo-bin -c odoo19/odoo.conf in your terminal).
  3. Open your Web Browser and navigate to:
    👉 http://127.0.0.1:8099/


Rating
0 0

There are no comments for now.