Skip to content

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:

  1. Docker Environment (Recommended) - Simpler setup, consistent across platforms
  2. 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

Quick Start

  1. Clone the repository:

    git clone git@github.com:Bright-Village/odoo_dev_env_cnf.git
    cd odoo_dev_env_cnf
    

  2. Initialize the environment:

    make init
    
    This command will:

  3. Update git submodules (Odoo core and enterprise)
  4. Create the odoo-data folder with correct permissions

  5. Start the containers:

    docker compose up
    

  6. Access Odoo:

  7. Open your browser to http://localhost:8065
  8. Default credentials: admin/admin

Docker Environment Architecture

The Docker setup includes:

  • Odoo Container: Based on amd64/odoo:13 image
  • Custom modules from ./custom_addons
  • Enterprise modules from ./odoo_enterprise
  • Additional Python dependencies installed
  • PostgreSQL Container: postgres:15 image
  • 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

  1. Clone and initialize:

    git clone git@github.com:Bright-Village/odoo_dev_env_cnf.git
    cd odoo_dev_env_cnf
    make init
    

  2. Start Docker database (required for native Odoo):

    make start-bg
    

  3. Set up Python environment:

    make full-init
    
    This will:

  4. Install system dependencies
  5. Create Python virtual environment
  6. Install Odoo requirements
  7. Install wkhtmltopdf and other tools

  8. Run Odoo natively:

    make start-native
    

  9. Access Odoo:

  10. Open your browser to http://localhost:8069
  11. 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:

make test

Test results are logged to /test-data/test_log.txt. Clean up after testing:

make clean-test

Database Management

  • Reset database: Use make hard-restart to completely reset
  • Database shell: Use make dbshell to access PostgreSQL directly
  • Backup/Restore: Use standard PostgreSQL tools or Odoo's built-in backup

Remote Debugging with PyCharm

For advanced debugging capabilities:

  1. Configure PyCharm version in Dockerfile.dev:

    && python3 -m pip install pydevd_pycharm=={your_pycharm_version}
    

  2. Build debug image:

    docker compose -f docker-compose-debug.yaml build
    

  3. Start debug containers:

    docker compose -f docker-compose-debug.yaml up -d
    

  4. Configure PyCharm path mappings:

  5. Docker Container Path: /usr/lib/python3/dist-packages/odoo
  6. Local Path: ~/your_project/odoo