Upgrading Odoo to a new major version is one of the most demanding tasks for an administrator. Even a well-prepared Odoo database migration can end in an error: an interrupted process, a module that doesn't work, or missing data. The good news is that most problems have recurring causes and can be fixed effectively. In this guide, we show you how to diagnose and resolve them.
If you want to see how the new features work before you decide to migrate, try Odoo for free.
Why does database migration cause so much trouble?
Every major Odoo version changes the structure of tables, views, models, and business logic. The database has to be transformed to match the new code. As long as you use only standard modules, the process is largely automated. Problems appear when your system includes:
- custom modules and in-house customizations,
- third-party modules that have no version for the target release,
- inconsistent data accumulated over years of use,
- large databases with millions of records,
- an incorrect server or PostgreSQL configuration.
Always check the latest release information and technical requirements in the official Odoo documentation and release notes, because Python and PostgreSQL requirements change between versions.
It is also worth knowing the available migration paths. Enterprise customers (including Odoo Online and Odoo.sh) can use the official Odoo upgrade platform, which processes the database with standard modules. Community users usually rely on the OpenUpgrade community project, which covers Community modules and requires going through each major version one after another. In both cases, you have to adapt custom modules yourself.
Preparation: what to do before you start the migration
Most errors can be avoided at the preparation stage. Before you touch the production database, follow the steps below.
1. Make a complete backup
The backup must include the database and the filestore, that is, attachments and files. Without the filestore, you will see missing images and documents after restoring. A ZIP backup created from the Database Manager contains both elements. We described how to automate this process in the article How to set up automatic backups in Odoo?.
2. Always work on a copy
Never test a migration on production. Restore the backup on a separate server or in a separate database and run your trials there. To prevent the test copy from sending real emails or running scheduled actions, neutralize it, for example with the command odoo-bin neutralize -d nazwa_bazy (available in newer versions), or select the copy option when restoring from the Database Manager. We cover managing databases from the interface in the article Odoo Database Manager: How It Works and How to Secure It.
3. Take an inventory of your modules
Make a list of standard, custom, and third-party modules. For each of them, check whether a version compatible with the target release exists. Modules without such a version have to be rewritten or replaced.
The most common problems and how to fix them
Incompatible custom modules
This is the most common cause of an interrupted migration. Typical symptoms include import errors, missing dependencies, or the use of methods and fields that have been removed or renamed. The solution is as follows:
- analyze the log and find the name of the module that causes the error,
- adapt the code to the API of the new version (fields, decorators, views),
- update the
__manifest__.pyfile, including the version number (e.g. in the format19.0.1.0.0, matching the target version) and dependencies, - if needed, add migration scripts in the
migrations/<module_version>/directory (files with the pre-, post-, or end- prefix).
View errors and ParseError
Inherited views that refer to elements removed or changed in the new version end with a ParseError or ValidationError. Common examples are the deprecation of the attrs and states attributes in favor of direct expressions (e.g. invisible, readonly) in Odoo 17, and the change of the <tree> tag to <list> in Odoo 18. Find the view indicated in the log, fix the XPath expression, or temporarily disable the view on the test copy to continue diagnostics.
Inconsistent data and orphaned records
Foreign key violations, empty values in required fields, or duplicate records halt the upgrade. Fix them with SQL queries on a copy of the database, and then run the process again. Before making any changes, always create an additional backup, and record every fix in a script so that it can be repeated during the final production migration.
PostgreSQL and database restore issues
Errors during restore are usually caused by differences in PostgreSQL versions, missing required extensions, or incorrect database user permissions. You can create a custom-format backup with the pg_dump -Fc command and restore it using pg_restore into a previously created, empty database. Make sure the user has permissions to create and modify objects and that the required extensions are installed. Remember to restore the filestore as well.
Timeouts and performance with large databases
With large datasets, migration can take many hours, and low memory or time limits cause it to fail. For the duration of the process, increase parameters such as limit_time_cpu, limit_time_real, limit_memory_soft, and limit_memory_hard, and also schedule a maintenance window. You will find tips on tuning your environment in the articles How to Optimize Odoo Performance? Proven Methods and How to Configure Odoo with Multiple Workers?.
When the migration involves extensive customizations and several years of data, it is worth getting help from an experienced team that will carry out the entire process safely.
How to read logs and find the cause of an error
Logs are the most important diagnostic tool. Run the upgrade on a copy using the target version's code (for the Community edition, this will be the OpenUpgrade code) and a higher log verbosity level, for example:
odoo-bin -d nazwa_bazy -u all --stop-after-init --log-level=debug
Look for the first entry with the ERROR or CRITICAL level, because subsequent errors are often just its consequence. Pay attention to the module name, file, and line number. To save messages to a file and easily go back through the history, configure logging following the guide How to Configure File Logging in Odoo.
Step-by-step migration: a proven action plan
- Back up the database and the filestore.
- Restore the backup in a test environment and neutralize it.
- Update or rewrite custom modules for the target version.
- Run the migration (through the Odoo upgrade platform for Enterprise or the OpenUpgrade community tool for Community) and save the logs.
- Fix the errors, then repeat the test on a fresh copy until the process runs without obstacles.
- Test key processes: sales, purchasing, inventory, accounting, and reports.
- Schedule a maintenance window and perform the final production migration.
If you use Odoo.sh hosting, some tasks, such as backups and test environments, are available out of the box. You can find more about the configuration in the article How to Install Odoo.sh: Step-by-Step Guide.
Get to know Odoo in practice and see what a modern system looks like, one that is worth migrating your data to.
After migration: verification and cleanup
When the process finishes successfully, don't stop there. Check accounting balances, stock levels, user permissions, scheduled actions, email templates, and reports. Also verify external integrations, such as payment gateways or API connections. After the results are accepted, delete unnecessary test databases using the guide How to Delete an Odoo Database: Step-by-Step Guide. Keep the old production database as an archive for a set period of time.
FAQ – Frequently Asked Questions
Can I migrate the database directly on production?
This is not recommended. Always test the migration on a copy of the database, and only after a positive result run it on the production environment, with an up-to-date backup in place.
What should I do if the migration stops at one module?
Find the first error in the log, check the module's compatibility with the target Odoo version, and fix the code or dependencies. If the module is not critical, you can uninstall it before the migration and deploy it again once the migration is complete. Keep in mind, however, that uninstalling may delete data related to the module, so test this on a test copy first.
How long does an Odoo database migration take?
The time depends on the database size, the number of custom modules, and the quality of the data. Small databases migrate in several dozen minutes, while large ones may require several hours, so it is worth scheduling a maintenance window and running a trial on a copy.
Summary
A successful Odoo database migration rests on three pillars: thorough preparation, testing on a copy, and careful log analysis. Most errors stem from incompatible modules, inconsistent data, and incorrect environment configuration, and all of these causes can be eliminated with a methodical approach.
Do you need support with migration, error fixing, or adapting modules to a new version? The KK Innovations team will gladly plan and carry out the entire process together with you. Contact us today.