Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save PierreAlainKouakou/d4cc3bc60ea05c6d06580d870d221357 to your computer and use it in GitHub Desktop.
Save PierreAlainKouakou/d4cc3bc60ea05c6d06580d870d221357 to your computer and use it in GitHub Desktop.
Configure Odoo for Development enviroment in VSCode

Install postgresql

sudo apt install postgresql postgresql-client
sudo -u postgres createuser -s $USER
createdb odoo-dev-13.0
createdb odoo-dev-14.0

Install Dependencies

Debian 10

sudo apt update
sudo apt upgrade
sudo apt install python3-dev python3-pip python3-venv libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev \
    libtiff5-dev libjpeg62-turbo-dev libopenjp2-7-dev zlib1g-dev libfreetype6-dev \
    liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev libpq-dev

Ubuntu 20.04

sudo apt update
sudo apt upgrade
sudo apt install python3-dev python3-pip python3-venv libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev \
    libtiff5-dev libjpeg8-dev libopenjp2-7-dev zlib1g-dev libfreetype6-dev \
    liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev libpq-dev

Create folders structure

mkdir -p ~/Odoo/{src,workspaces,instances,instances/odoo-dev-13.0,instances/odoo-dev-14.0}

Clone Odoo Source Code

git clone https://github.com/odoo/odoo.git --single-branch --depth 1 --branch 13.0 ~/Odoo/src/13.0
git clone https://github.com/odoo/odoo.git --single-branch --depth 1 --branch 14.0 ~/Odoo/src/14.0

Creating virtualenv for instances

python3 -m venv ~/Odoo/instances/odoo-dev-13.0/venv
python3 -m venv ~/Odoo/instances/odoo-dev-14.0/venv

Copy odoo.conf file for instances

cp ~/Odoo/src/13.0/debian/odoo.conf ~/Odoo/instances/odoo-dev-13.0
sed -i 's/db_user = odoo/db_user = '$USER'/' ~/Odoo/instances/odoo-dev-13.0/odoo.conf
cp ~/Odoo/src/14.0/debian/odoo.conf ~/Odoo/instances/odoo-dev-14.0
sed -i 's/db_user = odoo/db_user = '$USER'/' ~/Odoo/instances/odoo-dev-14.0/odoo.conf

Install Odoo requirements.txt

source ~/Odoo/instances/odoo-dev-13.0/venv/bin/activate
pip3 install setuptools wheel inotify psycopg2-binary
pip3 install -r ~/Odoo/src/13.0/requirements.txt
deactivate
source ~/Odoo/instances/odoo-dev-14.0/venv/bin/activate
pip3 install setuptools wheel inotify psycopg2-binary
pip3 install -r ~/Odoo/src/14.0/requirements.txt
deactivate

Initializate Odoo DB's

~/Odoo/instances/odoo-dev-13.0/venv/bin/python3 ~/Odoo/src/13.0/odoo-bin -c ~/Odoo/instances/odoo-dev-13.0/odoo.conf -d odoo-dev-13.0 -i base --stop-after-init
~/Odoo/instances/odoo-dev-14.0/venv/bin/python3 ~/Odoo/src/14.0/odoo-bin -c ~/Odoo/instances/odoo-dev-14.0/odoo.conf -d odoo-dev-14.0 -i base --stop-after-init

Create launch.json files

file: ~/Odoo/instances/odoo-dev-13.0/.vscode/launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "odoo-dev-13.0",
            "type": "python",
            "request": "launch",
            "program": "~/Odoo/src/13.0/odoo-bin",
            "console": "integratedTerminal",
            "args": [
                "-c","~/Odoo/instances/odoo-dev-13.0/odoo.conf",
                "--limit-time-real", "99999",
                "-d", "odoo-dev-13.0"
            ]
        },
        {
            "name": "odoo-dev-13.0-install-addons",
            "type": "python",
            "request": "launch",
            "program": "~/Odoo/src/13.0/odoo-bin",
            "console": "integratedTerminal",
            "args": [
                "-c","~/Odoo/instances/odoo-dev-13.0/odoo.conf",
                "--limit-time-real", "99999",
                "-d", "odoo-dev-13.0",
                "-i","",
                "--stop-after-init"
            ]
        },
        {
            "name": "odoo-dev-13.0-update-addons",
            "type": "python",
            "request": "launch",
            "program": "~/Odoo/src/13.0/odoo-bin",
            "console": "integratedTerminal",
            "args": [
                "-c","~/Odoo/instances/odoo-dev-13.0/odoo.conf",
                "--limit-time-real", "99999",
                "-d", "odoo-dev-13.0",
                "-u","",
                "--stop-after-init"
            ]
        },
        {
            "name": "odoo-dev-13.0-repl",
            "type": "python",
            "request": "launch",
            "program": "~/Odoo/src/13.0/odoo-bin",
            "console": "integratedTerminal",
            "args": [
                "shell",
                "-c","~/Odoo/instances/odoo-dev-13.0/odoo.conf",
                "--limit-time-real", "99999",
                "--xmlrpc-port","8888",
                "--longpolling-port","8899",
                "-d", "odoo-dev-13.0",
                "--shell-interface", "ipython"
            ]
        }
    ]
}

file: ~/Odoo/instances/odoo-dev-14.0/.vscode/launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "odoo-dev-14.0",
            "type": "python",
            "request": "launch",
            "program": "~/Odoo/src/14.0/odoo-bin",
            "console": "integratedTerminal",
            "args": [
                "-c","~/Odoo/instances/odoo-dev-14.0/odoo.conf",
                "--limit-time-real", "99999",
                "-d", "odoo-dev-14.0"
            ]
        },
        {
            "name": "odoo-dev-14.0-install-addons",
            "type": "python",
            "request": "launch",
            "program": "~/Odoo/src/14.0/odoo-bin",
            "console": "integratedTerminal",
            "args": [
                "-c","~/Odoo/instances/odoo-dev-14.0/odoo.conf",
                "--limit-time-real", "99999",
                "-d", "odoo-dev-14.0",
                "-i","",
                "--stop-after-init"
            ]
        },
        {
            "name": "odoo-dev-14.0-update-addons",
            "type": "python",
            "request": "launch",
            "program": "~/Odoo/src/14.0/odoo-bin",
            "console": "integratedTerminal",
            "args": [
                "-c","~/Odoo/instances/odoo-dev-14.0/odoo.conf",
                "--limit-time-real", "99999",
                "-d", "odoo-dev-14.0",
                "-u","",
                "--stop-after-init"
            ]
        },
        {
            "name": "odoo-dev-14.0-repl",
            "type": "python",
            "request": "launch",
            "program": "~/Odoo/src/14.0/odoo-bin",
            "console": "integratedTerminal",
            "args": [
                "shell",
                "-c","~/Odoo/instances/odoo-dev-14.0/odoo.conf",
                "--limit-time-real", "99999",
                "--xmlrpc-port","8888",
                "--longpolling-port","8899",
                "-d", "odoo-dev-14.0",
                "--shell-interface", "ipython"
            ]
        }
    ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment