Skip to content

upgrade code

Sébastien Andreatta edited this page Apr 27, 2026 · 2 revisions

odev upgrade-code

upgrade-code demo

Run Odoo's native upgrade_code tool (Odoo 18.0+). This command uses Odoo's internal upgrade_code scripts to automaticallyrefactor source code (e.g., renaming to ).

Usage

odev upgrade-code [-v {CRITICAL,ERROR,WARNING,INFO,DEBUG,DEBUG_SQL,NOTSET}] [-h] [-f] [-c] [-V VERSION] [--venv VENV] [-w WORKTREE] [--no-pretty] [--from FROM_VERSION] [--to TO_VERSION] [--script SCRIPT] [--glob GLOB] [--dry-run] database [addons]

Aliases

No aliases

Arguments

Positional Arguments:

Argument Description
database The database to target.
addons Comma-separated list of additional addon paths. The standard Odoo addons paths are automatically added to the odoo-bin command (including enterprise if any enterprise module is installed). If this command is run from within an Odoo addons directory and no additional addons are specified, the current directory will be added to the list of addons.

Optional Arguments:

Argument Description
-v, --log-level Set logging verbosity for the execution of odev.
-h, --help Show help for the current command.
-f, --force Bypass confirmation prompts and assume a default value to all, use with caution!
-c, --community Force running the database without enterprise addons.
-V, --version The Odoo version to use for running the database. If not specified, defaults to the latest version of the base module installed in the database.
--venv Name of the Python virtual environment to use when running this database. If not specified, defaults to the common virtual environment for the current Odoo version.
-w, --worktree Name of the worktree to use when running this database. If not specified, defaults to the common worktree for the current Odoo version.
--no-pretty Do not pretty print the output of odoo-bin but rather display logs as output by the subprocess.
--from Run all scripts starting from this version, inclusive.
--to Run all scripts until this version, inclusive.
--script Run this single script name.
--glob Select the files to rewrite (default: **/*).
--dry-run Preview changes without writing.

Examples

Show help

odev upgrade-code --help

Run Odoo's native upgrade code tool

odev upgrade-code demo_19

Upgrade from version 17 to 19

odev upgrade-code --from 17 --to 19.0 demo_19

Dry run (Preview changes)

odev upgrade-code --from 17 --to 19.0 --dry-run demo_19

Target specific files (Glob)

odev upgrade-code --from 17 --to 19.0 --glob "my_module/**/*.xml" demo_19

Run a specific upgrade script

odev upgrade-code --script rename_tree_to_list demo_19

Clone this wiki locally