Skip to Content

1 - Setting Up Odoo Dev Environment

Establishing a robust and isolated development environment is the critical first step for any professional Odoo developer. Odoo 19 introduces advanced performance optimizations, native AI integrations, and full support for Python 3.12.

To align with official Odoo documentation and enterprise industry standards, this guide uses Ubuntu 24.04 LTS as the host operating system and Visual Studio Code (VS Code) as the primary Integrated Development Environment (IDE).


1. System Prerequisites

Developing for Odoo requires a system capable of handling complex relational databases and background processing.

  • Operating System: Ubuntu 24.04 LTS (Native or via WSL2 on Windows).

  • Python Engine: Python 3.10 to 3.12.

  • Database Engine: PostgreSQL 16 or higher.

  • Hardware: Minimum 4GB RAM (8GB+ highly recommended for optimal compilation and indexing speeds).


2. Infrastructure Setup (CLI)

The following terminal commands will provision your system with the exact dependencies required to compile Odoo 19 from its source code.

Step 1: Core System Dependencies

Update your package index and install the C-libraries required by Python packages (such as psycopg2 for database connections and lxml for XML parsing).

​sudo apt update && sudo apt upgrade -y
sudo apt install -y git wget curl python3-pip python3-dev python3-venv build-essential libxml2-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev libffi-dev libpq-dev libjpeg-dev

Step 2: Database Provisioning

Odoo relies entirely on PostgreSQL. Install the database server and create a superuser role matching your current system username to simplify local authentication.

sudo apt install postgresql -y
sudo -u postgres createuser -s $USER

Step 3: Source Code Acquisition

Cloning the Odoo source repository directly from GitHub is the industry standard. It allows you to seamlessly pull upstream updates and switch between Odoo versions.

mkdir ~/odoo-dev && cd ~/odoo-dev
git clone https://www.github.com/odoo/odoo --depth 1 --branch 19.0 --single-branch

Step 4: Python Virtual Environment Isolation

Enterprise developers never install project dependencies into the global operating system. We will create an isolated virtual environment (venv) to contain Odoo 19's specific Python packages.

python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r odoo/requirements.txt

Step 5: Wkhtmltopdf (Report Generation)

Odoo requires a specific, Qt-patched version of wkhtmltopdf to accurately render PDF reports (like Invoices and Sales Orders) with proper headers and footers.

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo apt install ./wkhtmltox_0.12.6.1-2.jammy_amd64.deb


3. Server Configuration (odoo.conf)

A dedicated configuration file dictates how your Odoo instance interacts with the database and where it looks for custom code. Create a file named odoo.conf in your root ~/odoo-dev directory:

[options]
; Master password for creating, backing up, or dropping databases:
admin_passwd = admin
; Database connection settings (False defaults to local peer authentication):
db_host = False
db_port = False
db_user = your_system_username
db_password = False
; Paths to the core modules and your custom modules:
addons_path = odoo/addons,../custom_addons
; Network settings:
http_port = 8069
log_level = info


4. Enterprise Best Practices & Advice

[!TIP] The Golden Rule of Module Development When actively writing code, always initialize your Odoo server using the -u (update) flag followed by your module's technical name. Example: > python3 odoo-bin -c odoo.conf -u my_custom_module. This forces the server to re-read your XML files and apply UI changes to the database.

  • Strict Code Isolation: Never directly modify files inside the odoo/ source directory. All customizations must reside in your external custom_addons directory to ensure your system remains upgradable.

  • Master Developer Mode: Upon logging into the Odoo web interface, immediately navigate to Settings and click Activate the developer mode (with assets). This unlocks technical menus and allows you to inspect field metadata directly from the browser interface.

  • Log Monitoring: In a professional setting, watching the terminal output is vital. Pay close attention to WARNING and ERROR logs during server startup, as they immediately indicate syntax errors or broken dependencies in your code.

Rating
0 0

There are no comments for now.

to be the first to leave a comment.