Common Odoo Migration Problems and How to Fix Them

Last updated: March 2026

Migrating an Odoo Community Edition database between major versions is one of the most complex operations you can perform on an ERP system. Every major release changes the database schema, renames fields and models, merges modules, and restructures views. This guide covers the most common problems and their solutions.

1. Foreign key violations

The most common migration error. During an upgrade, Odoo's _process_end function deletes xmlid-tracked records that no longer exist in the target version. If other tables still reference those records via foreign keys, PostgreSQL blocks the deletion with a ForeignKeyViolation error.

This is especially common with accounting data (tax groups, chart of accounts templates) and localization records.

Fix: Before the upgrade, scan for orphaned foreign key references. Set nullable references to NULL and remove non-nullable orphans.

2. Module conflicts after upgrade

Modules stuck in "to upgrade" or "to install" state cause the "Odoo is currently processing another module operation" error. This happens when the upgrade process crashed before resetting module states.

Fix: UPDATE ir_module_module SET state = 'installed' WHERE state IN ('to upgrade', 'to install');

3. View errors and broken XML

Inherited views use XPath expressions to modify parent views. When parent views change between versions, those XPath expressions break. Errors include "Element cannot be located in parent view" and "Invalid view definition".

Fix: Clear arch_db on inherited views so Odoo reloads them from the new version's XML files. Disable third-party module views before upgrading.

4. ir_property to JSONB conversion failures (17 to 18)

Odoo 18's biggest architectural change: company-dependent fields move from the ir_property table to native JSONB columns. ALTER COLUMN TYPE jsonb fails when columns contain non-JSON values.

Fix: Drop non-JSONB company-dependent columns before the upgrade. The data is safe in ir_property and will be migrated to JSONB columns post-upgrade.

5. Demo data deletion cascade

Odoo's _process_end tries to delete records whose xmlids were removed. The ORM's unlink() triggers flush_all() which triggers _recompute_all() on other records that reference the deleted ones, causing MissingError.

Fix: Replace _process_end with a raw SQL implementation that avoids ORM recomputation. Suspend UNIQUE constraints during demo data loading.

6. Third-party module compatibility

Third-party modules reference models, fields, and views from the version they were written for. When you upgrade, renamed models (Odoo 19 renames 130), dropped fields, and changed method signatures break these modules.

Fix: Keep modules installed but disable their views before upgrading. Install updated versions after migration. Do not uninstall modules before migration as this can cascade-delete business data.

7. Constraint violations

New Odoo versions add UNIQUE, CHECK, and NOT NULL constraints. Production data accumulated over years may not satisfy new constraints.

Fix: Validate data against target constraints before upgrading. Use PostgreSQL savepoints to test each constraint safely. Merge or remove duplicate rows for UNIQUE violations.

8. Field translate type change (18 to 19)

ir_model_fields.translate changes from boolean to selection in Odoo 19. Odoo's loading code reads this column before pre-migration hooks run, causing it to treat every field as translated and attempt mass JSONB conversion.

Fix: Convert the column type before Odoo starts, in the migration runner, not in a pre-migration hook.

How OCU prevents these issues

OCU handles all of the above automatically: FK orphan cleanup, module state reset, view clearing with user customization preservation, ir_property conversion, raw SQL _process_end replacement, constraint validation with savepoints, and translate field pre-conversion.

Frequently asked questions

Why does my Odoo migration fail with a foreign key error?
Foreign key errors happen when a record references another record that was deleted during migration. Odoo's _process_end function removes xmlid-tracked records that no longer exist in the target version, but other tables may still reference them.
How do I fix "module is currently being processed" after upgrade?
Reset stuck modules: UPDATE ir_module_module SET state = 'installed' WHERE state IN ('to upgrade', 'to install'). Then restart Odoo.
Can I migrate Odoo with third-party modules installed?
Yes. Data tables are preserved but views are disabled. Install updated module versions after migration.
What should I do if my migration takes too long?
Archive old records before migrating. Run a test migration first to get an accurate time estimate.
Is it safe to migrate directly from Odoo 16 to 19?
You cannot skip versions, but tools like OCU chain the steps (16 to 17 to 18 to 19) automatically into a single operation.

Start your free test migration