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.comInterrupted? 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,psqlandcreatedb, matching your server version (for exampleapt install postgresql-client). - Read access to the Odoo database, through the local socket or
--db-host,--db-userandPGPASSWORDor~/.pgpass. - Free disk space of about 1.5 times the database size for the dump, the download and the local restore. Point
--workdirat a bigger disk if pre-flight warns.
What a run does
- 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.
- 2Dump. Runs pg_dump in custom format. The filestore, when found, is zipped alongside.
- 3Upload. Sends the dump in 64 MB chunks. A dropped connection resumes from the last chunk instead of starting over.
- 4Live log. Streams the migration log with a progress bar and reconnects on its own if the connection drops.
- 5Download. Fetches the upgraded database, resumable, and verifies it against its SHA-256 checksum.
- 6Restore. Restores it locally with pg_restore -j N into <db>_test (test run) or <db>_upgraded (production run), filestore included.
Commands
| Command | What it does |
|---|---|
test | Test upgrade. The result is staging-neutralized and restored locally as <db>_test, so you can check it without touching live settings. |
production | Production upgrade. Live configuration is kept and the result is restored as <db>_upgraded. |
status | Shows 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
| Option | Meaning |
|---|---|
-d, --database DBNAME | Local PostgreSQL database to upgrade. Required. |
-t, --target VERSION | Target 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, --email | Email for the audit report and job recovery. |
--name | Your name or company, shown on the audit report. |
-j, --jobs N | Parallel jobs for the local pg_restore. Default 4. |
--db-host | PostgreSQL host. Default: local socket. |
--db-port | PostgreSQL port. Default 5432. |
--db-user | PostgreSQL user. Default: the current user. |
--db-password | PostgreSQL password. PGPASSWORD or ~/.pgpass is the safer choice. |
--ask-password | Prompt for the PostgreSQL password instead. |
--filestore [PATH] | Include the filestore. Auto-detected when PATH is left out. |
--no-filestore | Leave the filestore out. Attachments are then not part of the upgrade. |
--restore-as NEW_DB | Name of the restored database. |
--no-restore | Download the upgraded file only, without restoring it. |
--overwrite | Replace the restore target if a database with that name already exists. |
--workdir DIR | Directory for the dump and the download. Default: the system temp folder. |
--keep-dump | Keep the local dump after the upload. |
-v, --verbose | Show the full engine log. |
--version | Print 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.comTest run on Windows PowerShell
irm https://iventureteam.com/upgrade.py | python - test -d my_db -t 20.0 --email you@company.comDownload 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.0Database 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-passwordFilestore 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/bigProduction run, restored under a new name
python3 upgrade.py production -d my_db -t 20.0 --restore-as my_db_v20 -j 8Check on a running job
python3 upgrade.py statusSupported 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.
