Automate common tasks relative to working with Odoo development databases.
Odev is a multi-purpose tool designed for making the life of Odoo developers and support analysts easier.
It provides wrapper scripts around common tasks, speeding up the whole process of working with databases and allowing shortcuts to otherwise lengthy commands.
Before you can run this tool, make sure the below requirements are set on your system:
- Python 3.10.12 or higher (3.12+ is recommended)
- Python's virtualenv module (this is not python3-venv)
- PostgreSQL as from Odoo's source install requirements
- Other Odoo dependencies
Make sure git is properly setup with SSH key authentication before using commands, as Odev will try to connect to
the Odoo Community and Enterprise repositories
to pull sources when required.
Clone the odev repository to your computer and navigate to the odev folder:
git clone https://github.com/odoo-odev/odev.git && cd odevRun the install script:
./install.shRun odev setup to configure odev:
odev setupThat's it! You are ready to go, use odev from anywhere in your terminal to use it.
Odev will update itself automatically when new versions are available.
Submit a pull request to merge your development to the main branch. After review and proper testing, your feature will
be made available to all.
You have ideas to share but you don't want to dive in odev's source code? No worries, you can also create a new
issue with the tags bug or enhancement to request a new
feature.
Check the Contribution Guide for more details about the contribution process.
Odev works with subcommands, each having specific effects.
Usage: odev <command> <args>
Arguments in square brackets ([arg]) are optional and can be omitted, arguments in curvy brackets ({arg}) are
options to choose from, arguments without brackets (arg) are required.
To see the list of all commands run odev help.
To get help on a specific command and its usage, use odev help <command>.
Odev can be extended with plugins that are loaded from external GitHub repositories, they could be public or private to your organizations and allow to add new features and commands or modify existing ones.
Plugins can be enabled with the predefined command odev plugin --enable <plugin>.
| Name | Description |
|---|---|
| odoo-odev/odev-plugin-ai-translation | Generate Odoo module translations using AI. |
| odoo-odev/odev-plugin-ai-scaffold | Scaffold Odoo modules using AI, based on a formatted technical specification. |
| odoo-odev/odev-plugin-editor-vscode | Interact with VSCode, open a debugger session and configure workspaces. |
| odoo-odev/odev-plugin-export | Export customizations from a database and convert Studio to code. |
| odoo-odev/odev-plugin-project | Follow-up on projects and setup working directories for creating new Odoo modules. |
| odoo-ps/odev-plugin-hosted | Interact with PaaS (odoo.sh) and SaaS (Odoo Online) databases, requires Odoo Technical Support access level. |
To avoid inputting the credentials every time odev is run, symmetric encryption is used to store them. This is done
"automagically" with the help of an ssh-agent-loaded key. This means
that ssh-agent needs to be available in the shell environment the command is being run from, otherwise a warning will
be logged and credentials will need to be inputted every time. If you don't already have a custom script to launch
ssh-agent, we recommend using keychain, that's an easy option to do that and manage the different keys available
through ssh-agent.
After installing keychain, and depending on the shell of your choice, the following lines need to be added to the
.bashrc/.zshrc:
/usr/bin/keychain -q --nogui $HOME/.ssh/id_rsa
source $HOME/.keychain/$HOST-shAlternatively, you can save the following script into a new file under ~/.profile.d/start_ssh_agent and make it
run automatically at startup by adding the line source ~/.profile.d/start_ssh_agent to your ~/.bashrc or ~/.zshrc
file.
#!/bin/sh
# ==============================================================================
# This script loads declared SSH keys into the running ssh-agent, launching it
# if necessary. This should ideally be sourced in the user's shell profile.
# ==============================================================================
env=~/.ssh/agent.env
# --- Declare the path to the keys to add to the agent -------------------------
declare -a keys=(
"$HOME/.ssh/id_ed25519" # <-- Edit this line to load your own SSH key(s)
)
# --- Common methods and shortcuts ---------------------------------------------
agent_load_env() {
test -f "$env" && . "$env" >| /dev/null
}
agent_start() {
(umask 077; ssh-agent >| "$env")
. "$env" >| /dev/null 2>&1
}
agent_add_key() {
ssh-add $key >| /dev/null 2>&1
}
agent_add_keys() {
for i in "${keys[@]}"; do
ssh-add "$i" >| /dev/null 2>&1
done
}
# --- Load the agent -----------------------------------------------------------
agent_load_env
# agent_run_state:
# 0: agent running with key
# 1: agent running without key
# 2: agent not running
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)
# --- Load the keys to the agent -----------------------------------------------
if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
agent_start
agent_add_keys
elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then
agent_add_keys
fi
unset env