Project

General

Profile

Actions

Create dev environment with OCA

Requirements

We assume you already have:

  • VScode installed
  • Python3 installed
  • You have PostGreSQL

Setup process

Clone Odoo

Create an empty folder. If you plan to work with several odoo versions, you should create a folder with version name (e.g. odoo17).

Due to virtual environment, don't rename or move this folder.

BRANCH=17.0
git clone --depth=1 --branch ${BRANCH} --single-branch https://github.com/odoo/odoo

Install virtual environment

Create virtualenv and install dependancies

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

Add OCA packages

To install OCA packages, download the xz file corresponding to your odoo version here (check you have the latest version)
https://projects.iabsis.com/projects/odoo-oca/files

Extract into your project root folder and name it "oca", it should containing all oca addons.

Create odoo.conf config and empty dev folder for your new modules

Now copy odoo.conf config file into your root folder

cp odoo/debian/odoo.conf odoo.conf
mkdir dev

Edit the file to be able to connect on PostGreSQL. Also update the addons_path, you should have something like that:

addons_path = dev,oca,odoo/addons
db_password = odoo
db_port = 5432
db_template = template0
db_user = odoo

Add Debug configuration in Vscode

From Vscode, press CTRL+SHIFT+P and search for "Debug: add configuration...". Paste the following debug profile.

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Odoo17",
            "type": "debugpy",
            "request": "launch",
            "program": "odoo/odoo-bin",
            "console": "integratedTerminal",
            "justMyCode": true,
            "args": [
                "-c",
                "odoo.conf",
                "--limit-time-real",
                "99999",
                "--log-handler",
                "odoo.tools.convert:DEBUG"
            ],
        }
    ]
}

It's ready

Now simply click on the green start from debug panel.

Updated by Olivier Bitsch 6 months ago · 5 revisions