Skip to main content
iVentureTeam

Odoo upgrade from the command line

upgrade.py upgrades a local Odoo 13.0 to 19.0 database to any newer version up to Odoo 20, Community or Enterprise, without leaving your terminal. Use it when the database is over the 5 GB browser limit, or when you would rather not export a backup by hand. It is one Python file with nothing to pip install. Prefer a browser? Use the upload wizard instead.

Quick start

Run a test upgrade to Odoo 20 on the machine that can reach your database:

python3 <(curl -sSL https://iventureteam.com/upgrade.py) test -d my_db -t 20.0 --email you@company.com

Interrupted? Run the same command again. The upload resumes where it stopped, and a migration that is already running is re-attached instead of started twice.

Requirements

  • Python 3.7 or newer. The client uses the standard library only.
  • PostgreSQL client tools on your PATH: pg_dump, pg_restore, psql and createdb, matching your server version (for example apt install postgresql-client).
  • Read access to the Odoo database, through the local socket or --db-host, --db-user and PGPASSWORD or ~/.pgpass.
  • Free disk space of about 1.5 times the database size for the dump, the download and the local restore. Point --workdir at a bigger disk if pre-flight warns.

What a run does

  1. 1Pre-flight. Checks that pg_dump, pg_restore, psql and createdb are on your PATH, reads the Odoo version from the database, measures its size, finds the filestore and checks free disk space.
  2. 2Dump. Runs pg_dump in custom format. The filestore, when found, is zipped alongside.
  3. 3Upload. Sends the dump in 64 MB chunks. A dropped connection resumes from the last chunk instead of starting over.
  4. 4Live log. Streams the migration log with a progress bar and reconnects on its own if the connection drops.
  5. 5Download. Fetches the upgraded database, resumable, and verifies it against its SHA-256 checksum.
  6. 6Restore. Restores it locally with pg_restore -j N into <db>_test (test run) or <db>_upgraded (production run), filestore included.

Commands

CommandWhat it does
testTest upgrade. The result is staging-neutralized and restored locally as <db>_test, so you can check it without touching live settings.
productionProduction upgrade. Live configuration is kept and the result is restored as <db>_upgraded.
statusShows the state of an existing job. Takes --job and --token; both default to the latest job started on this machine.

Options for test and production

OptionMeaning
-d, --database DBNAMELocal PostgreSQL database to upgrade. Required.
-t, --target VERSIONTarget Odoo version: 14.0, 15.0, 16.0, 17.0, 18.0, 19.0 or 20.0. Must be newer than the database. Required.
-e, --emailEmail for the audit report and job recovery.
--nameYour name or company, shown on the audit report.
-j, --jobs NParallel jobs for the local pg_restore. Default 4.
--db-hostPostgreSQL host. Default: local socket.
--db-portPostgreSQL port. Default 5432.
--db-userPostgreSQL user. Default: the current user.
--db-passwordPostgreSQL password. PGPASSWORD or ~/.pgpass is the safer choice.
--ask-passwordPrompt for the PostgreSQL password instead.
--filestore [PATH]Include the filestore. Auto-detected when PATH is left out.
--no-filestoreLeave the filestore out. Attachments are then not part of the upgrade.
--restore-as NEW_DBName of the restored database.
--no-restoreDownload the upgraded file only, without restoring it.
--overwriteReplace the restore target if a database with that name already exists.
--workdir DIRDirectory for the dump and the download. Default: the system temp folder.
--keep-dumpKeep the local dump after the upload.
-v, --verboseShow the full engine log.
--versionPrint the client version and exit.

Run python3 upgrade.py --help or python3 upgrade.py test --help for the same list in your terminal.

Examples

Test run to Odoo 20 (macOS, Linux)

python3 <(curl -sSL https://iventureteam.com/upgrade.py) test -d my_db -t 20.0 --email you@company.com

Test run on Windows PowerShell

irm https://iventureteam.com/upgrade.py | python - test -d my_db -t 20.0 --email you@company.com

Download once, then run (Windows cmd)

curl.exe -sSL https://iventureteam.com/upgrade.py -o upgrade.py && python upgrade.py test -d my_db -t 20.0

Database on another host, password prompt

python3 upgrade.py test -d my_db -t 20.0 --db-host 10.0.0.5 --db-user odoo --ask-password

Filestore in a custom folder, big work disk

python3 upgrade.py test -d my_db -t 20.0 --filestore /opt/odoo/data/filestore/my_db --workdir /mnt/big

Production run, restored under a new name

python3 upgrade.py production -d my_db -t 20.0 --restore-as my_db_v20 -j 8

Check on a running job

python3 upgrade.py status

Supported versions

Source databases from Odoo 13.0 to 19.0, to any newer target up to 20.0. The engine applies every version in between, in order, in one job. The full version matrix shows the number of steps for each jump.

Your data

Your database is used solely to perform the upgrade, transferred over an encrypted connection, never shared with third parties, and deleted from our servers 72 hours after the job finishes.

Custom modules

The tool migrates Odoo's own modules and your data. Custom and third-party modules need their code ported to the new version, which our team does as part of our Odoo upgrade services.

We use cookies to improve your experience

Essential cookies make the site work, and we use analytics to improve it. Choose “Only necessary” to turn analytics off. See our cookie policy.