+86 755 8671 9955

CALL US

How to Upgrade Odoo 19 to 20: Step-by-Step Guide for Databases and Custom Modules

If you want to know how to upgrade Odoo 19 to 20, start with a clear plan. An Odoo upgrade has two parts. The first part moves your database and standard apps to the new version. The second part ports your custom modules so they run on Odoo 20 without errors. If you skip either part, the upgrade stalls.

This guide covers both parts. You will find the upgrade path for Enterprise and Community, the structure of an upgrade script, command line options, Docker and Odoo.sh tips, and fixes for the most common errors. If you run Odoo in Hong Kong and want expert help, our team offers an Odoo migration service in Hong Kong.

Why Upgrade From Odoo 19 to Odoo 20

Each major Odoo version brings new features, security fixes, and performance work. Odoo supports only the latest three major versions. Older versions stop receiving fixes, so staying behind raises your security and compliance risk.

An upgrade also keeps your custom modules close to the current code base. A small jump from 19 to 20 costs far less than a late jump across four versions. Teams who upgrade once a year spend less time on each project and face fewer surprises.

Before You Start: Upgrade Checklist

Prepare these items before you touch the production database.

  • Take a full backup of the database and the filestore.
  • List every custom module and every third-party module you run.
  • Check each third-party module for a published 20.0 build.
  • Remove modules you no longer use. Uninstall them on Odoo 19 first.
  • Clone production to a test server with the same hardware and Python version.
  • Write down your key business flows, such as quotes, invoices, stock moves, and payroll. You will test each one after the upgrade.
  • Set a freeze date. Nobody should change data in production once the final upgrade starts.

Custom modules decide your timeline. Odoo will not finish a database upgrade until every installed module exists for the target version.

How to Upgrade Odoo 19 to 20 (Database Upgrade Steps)

The path depends on your edition and hosting.

Odoo Enterprise and Odoo.sh

Odoo provides an upgrade platform for Enterprise customers. The process follows the same pattern for every version.

  1. Request an upgraded test copy of your Odoo 19 database from Odoo’s upgrade platform.
  2. Port your custom modules to 20.0 while the upgrade runs.
  3. Load the upgraded test database on a test server with your 20.0 custom code.
  4. Test every business flow and fix the errors in the upgrade log.
  5. Repeat the test upgrade until the result is clean.
  6. Schedule the production upgrade and freeze data entry.
  7. Upgrade production, run a final check, and open access to your users.

Odoo.sh users follow the same logic inside the platform. Build a staging branch from an upgraded copy of production, push your 20.0 code to it, and read the build log before you go live.

Odoo Community

Odoo does not run the upgrade platform for Community databases. Community users rely on OpenUpgrade, a project from the Odoo Community Association. The next section explains that path.

Upgrade Odoo 18 to 19 Community Edition

OpenUpgrade provides migration scripts for the Community apps. It moves a database one major version at a time. To move from 18 to 19, follow this order.

  1. Back up the database and filestore.
  2. Restore the backup on a test server.
  3. Check the OpenUpgrade repository for a 19.0 branch and read its coverage table. The table shows which modules have migration scripts.
  4. Download the OpenUpgrade 19.0 code.
  5. Run the migration with the update all option on your test database.
  6. Switch to the standard Odoo 19 code and update again to apply final changes.
  7. Port your custom and OCA modules to 19.0.
  8. Test all flows before you repeat the process on production.

OpenUpgrade does not migrate your custom modules. You must port them and write migration scripts for any data they store. If you plan to go from 18 to 20, run the 19 step first and then repeat the process for 20. Community databases do not skip versions.

Odoo 19 to Odoo 20 Migration: What Usually Breaks

Most failed upgrades come from the same five areas.

  • Custom views written with old tags or attributes.
  • Python methods removed or renamed in the new version.
  • Third-party modules without a 20.0 build.
  • JavaScript and Owl components built on old APIs.
  • Custom reports and QWeb templates tied to changed fields.

Read the official Odoo 20 release notes with your module list open. Mark every model, view, and field your code touches. This one hour of reading saves days of debugging.

Odoo 19 Upgrade Script: Database Upgrade Custom Scripts

Custom modules store data. When a new version changes that data structure, you need an upgrade script. Odoo runs these scripts automatically during a module update.

Place the scripts in a migrations folder inside your module. Name the subfolder after the module version.

my_custom_module/
  __manifest__.py
  migrations/
    20.0.1.0.0/
      pre-migration.py
      post-migration.py
      end-migration.py

Odoo runs the folder when the module version stored in the database is lower than the folder version. Each file has a clear job.

  • pre-migration runs before Odoo loads the new module code. Use it to rename columns or tables.
  • post-migration runs after the module update. Use it to fill new fields or fix records.
  • end-migration runs after every module has updated. Use it for tasks with cross-module dependencies.

Each file defines one function.

def migrate(cr, version):
    cr.execute("""
        UPDATE my_model
        SET new_field = old_field
        WHERE new_field IS NULL
    """)

Keep each script short and safe to run twice. Test it on a copy of production with real data. Odoo also publishes a helper library named upgrade-util with tested functions for renaming models, fields, and XML IDs.

How to Upgrade a Custom Module in Odoo

A clear process makes module porting fast.

  1. Create a new branch in your code repository named after the target version.
  2. Run the automated code upgrade command.
  3. Fix errors the script cannot solve.
  4. Update the manifest version.
  5. Install the module on a clean 20.0 test database.
  6. Update the module on an upgraded copy of production.
  7. Run your tests and check the log.

Odoo Upgrade Code Command Line

Since Odoo 18, the Odoo source ships a tool named upgrade_code. It rewrites your source files with scripts for known changes between versions.

./odoo-bin upgrade_code --addons-path=/opt/odoo/custom-addons --from 19.0 --to 20.0 --dry-run

The dry run shows each change without writing files. Commit your code first. Review the output. Run the command again without the dry run option to apply the changes. Run ./odoo-bin upgrade_code --help on your version to confirm the options. The tool covers mechanical changes only. You still review the result by hand.

Odoo Manifest Version Upgrade

Every module has a manifest file. The version key tells Odoo which migration scripts to run. Use the series first, then your own module version.

{
    'name': 'My Custom Module',
    'version': '20.0.1.0.0',
    'depends': ['base', 'sale'],
    'license': 'LGPL-3',
}

The first two numbers match the Odoo series. The last three numbers track your own releases. Raise the last number whenever you ship a change with a migration script. Odoo compares this value with the one stored in the database.

Odoo Tree Tag to List Tag Migration

Odoo 18 renamed the tree view type to list. Modules built for Odoo 17 or older use the old name. You must update three places.

Before:

<record id="view_partner_tree" model="ir.ui.view">
    <field name="arch" type="xml">
        <tree>
            <field name="name"/>
        </tree>
    </field>
</record>

After:

<record id="view_partner_list" model="ir.ui.view">
    <field name="arch" type="xml">
        <list>
            <field name="name"/>
        </list>
    </field>
</record>
  • Replace the tree tag with the list tag in view architecture.
  • Replace tree with list in the view mode value of window actions.
  • Replace tree with list in any Python code or JavaScript code that names the view type.

The automated upgrade code tool handles most of these edits. Search your code for the word tree after you run it. Any leftover match is a bug waiting to appear.

Odoo Migrate Custom Module to V17, V18, or V19

The method stays the same for every version. The changes differ.

  • Moving to 17: replace the attrs and states attributes with direct Python expressions, such as invisible=”state != ‘draft'”.
  • Moving to 18: change tree to list and replace name_get methods with a computed display name.
  • Moving to 19 and 20: read the release notes for each version, run the upgrade code tool, and test.

Upgrade one version at a time when the gap is large. A module moved from 16 to 20 in one step produces long error lists. Four small steps produce four short lists.

Odoo Upgrade Module Command Line

The update flag tells Odoo to reload a module from disk and apply changes to the database.

./odoo-bin -c /etc/odoo/odoo.conf -d mydb -u my_custom_module --stop-after-init

Update several modules by separating names with commas. Update every installed module with the all keyword.

./odoo-bin -c /etc/odoo/odoo.conf -d mydb -u all --stop-after-init

Some searches mention an outdated flag together with the update all command. Odoo does not document that flag in its standard options. Run ./odoo-bin --help on your version to see what your server supports. Use the module name list or the all keyword.

Docker Exec Odoo Upgrade Module

To update a custom module in a Docker setup, run the command inside the container.

docker exec -it odoo-web odoo -d mydb -u my_custom_module --stop-after-init --no-http

The no-http option stops the new process from clashing with the web server already running on the same port. A command run with docker exec skips the image entrypoint. If the database connection fails, add the host, user, and password options.

docker exec -it odoo-web odoo -d mydb -u my_custom_module --stop-after-init --no-http --db_host=db --db_user=odoo --db_password=yourpassword

A second choice uses Docker Compose. It starts a short-lived container with your environment settings.

docker compose run --rm odoo odoo -d mydb -u my_custom_module --stop-after-init

Mount your custom addons folder as a volume. Restart the web container after the update finishes.

docker restart odoo-web

Odoo.sh Upgrade Custom Modules

Odoo.sh keeps your code in a Git repository with one branch per stage. Use this order for custom modules.

  1. Create a staging branch from your production branch.
  2. Build the staging database from an upgraded copy of production.
  3. Switch the branch to the 20.0 series and push your ported code.
  4. Open the build log and read every warning and error.
  5. Use the web shell to test imports and run module updates.
  6. Test your business flows on the staging build.
  7. Merge to production only when the staging build runs clean.

Never test an upgrade on the production branch.

Odoo OpenUpgrade Custom Modules

OpenUpgrade covers standard Community modules. Your custom modules sit outside its scope. Treat them in three steps.

  1. Port the code with the upgrade code tool and manual fixes.
  2. Write migration scripts for renamed models, fields, and XML IDs.
  3. Run your scripts during the OpenUpgrade run so the data moves with the schema.

OCA community modules follow the same rule. Check each module for a branch in the target version. Replace or remove any module without one.

Odoo Module Changes Not Reflecting After Restart

This problem frustrates many developers. A restart alone does not apply every change. Check these causes in order.

  • XML and data file changes need a module update with the update flag. A restart loads only Python code.
  • Python changes need a server restart. An update without a restart leaves old code in memory.
  • Your custom folder is missing from the addons path in the configuration file.
  • The module is not installed. Click Update Apps List, then install it.
  • Records marked with noupdate keep their old values. Change them by hand or force the update.
  • Browser cache holds old JavaScript. Hard refresh or open the page with the debug assets option.
  • You run several workers or servers. Restart all of them.
  • You edited a different copy of the module than the one Odoo loads. Check the logs to see the loaded path.

In Docker, confirm the volume mount points to your edited folder.

Odoo Custom Module Upgrade Best Practices

  • Keep every module in Git with one branch per Odoo series.
  • Run the upgrade on a copy of production data. An empty test database hides most errors.
  • Write automated tests for your key flows. Run them after each module update.
  • Keep migration scripts small and safe to run twice.
  • Remove dead modules and dead fields before the upgrade.
  • Read the upgrade log line by line. A warning today becomes an error tomorrow.
  • Document each custom module with its purpose, owner, and dependencies.
  • Upgrade every year. Small jumps cost less than large jumps.
  • Plan a rollback. Keep the Odoo 19 server and backup intact until users confirm the new system works.

Get Help With Your Odoo Upgrade in Hong Kong

Upgrade projects fail when teams underestimate custom code, data cleanup, and testing. A partner who has done this work before shortens the project and cuts risk. If you operate in Hong Kong, our Odoo migration service in Hong Kong covers database upgrades, custom module porting, and user testing. We plan each project around your calendar and your business flows.

If you do not run Odoo yet, our Odoo ERP implementation Hong Kong service takes you from requirements to go-live. To see how local businesses use the platform, read about Odoo Hong Kong and the support we provide in your time zone.

Frequently Asked Questions

How long does an Odoo 19 to 20 upgrade take?

A database with standard apps takes days. A database with many custom modules takes weeks. Module porting and testing take most of the time.

Do I need to upgrade one version at a time?

Odoo’s upgrade platform for Enterprise supports multi-version jumps. OpenUpgrade for Community moves one version at a time. Smaller steps also make errors easier to find.

Will my custom modules work after the upgrade?

Not without changes. Each major version changes code interfaces. Port every module and test it on an upgraded copy of your data.

Is it safe to upgrade Odoo Community with OpenUpgrade?

Yes, if you test first. Always run the upgrade on a copy, check the coverage table for your modules, and keep a backup.

What does the odoo-bin update flag do?

The update flag reloads a module from disk and applies view, data, and schema changes to the chosen database.

Why did my view break after upgrading to Odoo 18 or later?

Odoo 18 renamed the tree view type to list. Replace the old tag and view mode values in your custom modules.

Should I upgrade right after a new version launches?

Wait until your third-party modules have a build for the new version. Then plan the project with a test upgrade first.

Final Thoughts

A safe upgrade follows a fixed order. Back up, copy, port, script, test, and then go live. Treat custom modules as the main workload and give them time. Whether you run Enterprise, Community, Docker, or Odoo.sh, the same method applies. Start your test upgrade now so your production date stays under your control.

Facebook
Twitter
LinkedIn

Table of Contents

Recents

Looking for the best ERP software for your business? This guide ranks the top 10

Think of Odoo ERP for manufacturing as your all-in-one, efficient, cost-effective, and easy-to-use options which

Both Odoo Community vs Enterprise are built on the same core architecture, but they tackle

A digital contact graphic with a teal-to-dark gradient background. At the top, white text in both Chinese and English reads, "Follow or contact us on WeChat by scanning this QR code." Below the text is a large QR code with a green WeChat logo in the center. At the bottom, a search bar contains the text "同讯信息 ToncentSoft" next to a magnifying glass icon.