Developer Environment Setup
This guide provides instructions for setting up the CNF Odoo development environment. There are two primary ways to run the development environment:
- Docker Environment (Recommended) - Simpler setup, consistent across platforms
- Native Source Environment - Better for debugging, requires more setup
Prerequisites
Before proceeding with either setup method, ensure you have:
- Git installed
- Access to the CNF repositories
- Minimum 8GB RAM and 20GB available disk space
Option 1: Docker Environment Setup
Prerequisites for Docker Setup
- Docker Desktop installed and running
- PyCharm Professional (optional, for debugging)
Quick Start
-
Clone the repository:
-
Initialize the environment:
This command will: - Update git submodules (Odoo core and enterprise)
-
Create the
odoo-datafolder with correct permissions -
Start the containers:
-
Access Odoo:
- Open your browser to
http://localhost:8065 - Default credentials: admin/admin
Docker Environment Architecture
The Docker setup includes:
- Odoo Container: Based on
amd64/odoo:13image - Custom modules from
./custom_addons - Enterprise modules from
./odoo_enterprise - Additional Python dependencies installed
- PostgreSQL Container:
postgres:15image - Database accessible on port 5432
- Persistent data storage via Docker volumes
Useful Docker Commands
| Command | Description |
|---|---|
make start |
Start containers (foreground) |
make start-bg |
Start containers (background) |
make stop |
Stop all containers |
make restart |
Restart containers |
make ssh |
SSH into Odoo container |
make dbshell |
Access PostgreSQL shell |
make hard-stop |
Stop and remove all data |
make hard-restart |
Complete clean restart |
Option 2: Native Source Environment
The native setup runs Odoo directly on your system, which provides better debugging capabilities but requires more configuration.
Prerequisites for Native Setup
- Python 3.7+ (specifically tested with Python 3.7)
- PostgreSQL client
- System dependencies for Odoo
Native Setup Steps
-
Clone and initialize:
-
Start Docker database (required for native Odoo):
-
Set up Python environment:
This will: - Install system dependencies
- Create Python virtual environment
- Install Odoo requirements
-
Install wkhtmltopdf and other tools
-
Run Odoo natively:
-
Access Odoo:
- Open your browser to
http://localhost:8069 - Default credentials: admin/admin
Native Environment Configuration
The native setup uses different configuration files:
- Docker config:
configs/odoo.conf- Used by containers - Native config:
configs/odoo-native.conf- Used by native Odoo
Key differences in native configuration:
[options]
addons_path = ./odoo_enterprise, ./custom_addons, ./odoo/addons
data_dir = ./odoo-data
db_host = host.docker.internal # Connects to Docker PostgreSQL
db_password = odoo
db_user = odoo
db_name = odoo
db_port = 5432
Development Workflow
Module Development
The development environment includes 98+ custom modules located in:
- custom_addons/ - CNF-specific modules
- odoo_enterprise/ - Odoo Enterprise modules (submodule)
- odoo/addons/ - Odoo Community modules (submodule)
Testing
Run all Odoo tests:
Test results are logged to /test-data/test_log.txt. Clean up after testing:
Database Management
- Reset database: Use
make hard-restartto completely reset - Database shell: Use
make dbshellto access PostgreSQL directly - Backup/Restore: Use standard PostgreSQL tools or Odoo's built-in backup
Remote Debugging with PyCharm
For advanced debugging capabilities:
-
Configure PyCharm version in Dockerfile.dev:
-
Build debug image:
-
Start debug containers:
-
Configure PyCharm path mappings:
- Docker Container Path:
/usr/lib/python3/dist-packages/odoo - Local Path:
~/your_project/odoo