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. When something goes wrong, the error messages are often cryptic and the root cause is rarely obvious.

This guide covers the most common Odoo migration problems we have encountered across hundreds of real database migrations, along with practical solutions for each. Whether you are migrating manually, using OpenUpgrade, or an automated tool, these issues apply to every migration approach.

1. Foreign key violations

The single most common migration error. You will see something like:

psycopg2.errors.ForeignKeyViolation: update or delete on table "account_tax_group" violates foreign key constraint on table "account_tax"

Why it happens. During an upgrade, Odoo runs a function called _process_end that cleans up xmlid-tracked records that no longer exist in the target version. For example, if an account.tax.group record was defined in the XML data of version 17 but removed in version 18, Odoo tries to delete it. But if your account_tax table still has rows pointing to that tax group, PostgreSQL blocks the deletion with a foreign key violation.

This is especially common with accounting data (tax groups, chart of accounts templates), localization records, and any module that moved its XML data into a template system between versions.

How to fix it. Before the upgrade, scan for orphaned foreign key references and clean them up. For many-to-one fields on nullable columns, set the reference to NULL. For non-nullable columns, you may need to reassign the record to a valid target or delete the referencing row. This needs to be done for every FK pair that could be affected — a manual process that is difficult to get right exhaustively.

2. Module conflicts after upgrade

After a migration completes, you try to open Odoo and see:

Odoo is currently processing another module operation. Please try again later or contact your system administrator.

Why it happens. Modules can get stuck in the to upgrade or to install state in the ir_module_module table. This happens when the upgrade process crashed or was interrupted before it could reset module states. When you click Install, Upgrade or Uninstall, Odoo 19 checks for pending module operations and refuses to continue if any are found. Earlier versions do not have this check.

How to fix it. Connect to your PostgreSQL database and reset the stuck modules:

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

Then restart Odoo. If the underlying migration issue that caused the crash is not fixed, the problem will recur on the next upgrade attempt. Our guide to “Odoo is currently processing another module operation” covers the built-in reset in Odoo 19 and when to finish the operation instead.

3. View errors and broken XML

Inherited views are the most fragile part of any Odoo migration. Typical errors include:

Element '//field[@name="old_field_name"]' cannot be located in parent viewValidationError: Invalid view definition

Why it happens. Inherited views use XPath expressions to modify parent views. When the parent view changes between versions — fields renamed, elements removed, structure reorganized — those XPath expressions break. The inherited view is trying to modify an element that no longer exists.

This affects both standard Odoo views (where the parent changed between versions) and third-party module views (which were written for the old version's structure). For the 17 to 18 upgrade, views also need to handle the transition from translated arch_db JSONB to reloaded base templates.

How to fix it. For standard inherited views, clear the arch_db column so Odoo reloads them from the new version's XML files. For third-party module views, disable them before the upgrade and reinstall updated module versions afterward. Never delete base views — this orphans their children and causes cascading failures.

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

This error is specific to the Odoo 17 to 18 upgrade and is arguably the single biggest architectural change between any two Odoo versions:

psycopg2.errors.InvalidTextRepresentation: invalid input syntax for type json

Why it happens. In Odoo 17, company-dependent fields (fields with company_dependent=True) store their values in a central ir_property table, and the actual table column is a simple scalar type (varchar, integer, or float). In Odoo 18, these fields are stored directly on the model's table as JSONB columns. During the upgrade, Odoo's _auto_init tries to run ALTER COLUMN TYPE jsonb, which fails when the existing column contains plain text values like optional or always that are not valid JSON.

How to fix it. Before the upgrade, drop the non-JSONB columns from the source tables. The data is safe because the actual values live in ir_property. After the upgrade, Odoo's post-migration populates the new JSONB columns from the ir_property data. The tricky part is identifying every company-dependent column across all installed modules — it requires querying ir_model_fields and ir_property to build a complete list.

5. Demo data deletion cascade

If your database was originally installed with demo data, you may encounter this during migration:

odoo.exceptions.MissingError: Record does not exist or has been deleted.

Why it happens. Odoo's _process_end function identifies xmlid-tracked records that were not reloaded during the upgrade and tries to delete them via the ORM. The ORM's unlink() method calls flush_all(), which triggers _recompute_all() — computed fields on other records try to access the just-deleted records, causing a MissingError. This is not limited to demo databases; any database can be affected if computed fields reference records being cleaned up.

A related issue: demo data loading itself wraps failures in a savepoint, but the ORM defers writes past the savepoint boundary. The actual INSERT happens at commit(), causing UniqueViolation errors outside the exception handler.

How to fix it. This is one of the hardest migration problems to solve. Approaches include temporarily suspending UNIQUE constraints during the upgrade, using raw SQL for record deletion instead of the ORM (avoiding the recomputation cascade), and disabling FK enforcement during the cleanup phase. Each approach has trade-offs and edge cases.

6. Third-party module compatibility

Third-party modules from the OCA, the Odoo App Store, or custom development are the most unpredictable element in any migration. Common errors:

KeyError: 'model.name.that.no.longer.exists'ValueError: Field 'old_field' does not exist on model 'some.model'

Why it happens. Third-party modules are compiled against a specific Odoo version. When you upgrade, the module's Python code still references models, fields, methods, and view structures from the old version. If a model was renamed (Odoo 19 renames hr.contract to hr.version, for example), a field was dropped, or a method signature changed, the module breaks.

Even if you do not use the third-party module actively, Odoo still loads it during the upgrade if it is marked as installed in ir_module_module. Its views, constraints, and computed fields all execute during --update=all.

How to fix it. The safest approach is to keep the module installed in the database (preserving its data tables) but disable its views before the upgrade. This prevents XPath and field reference errors while keeping all the module's data intact. After migration, install the updated version of the module for the target Odoo version.

Uninstalling modules before migration is tempting but risky — Odoo's uninstall process cascades through dependent records and can delete business data.

7. Constraint violations

New versions often add stricter constraints. During migration, your existing data may not satisfy them:

psycopg2.errors.UniqueViolation: duplicate key value violates unique constraintpsycopg2.errors.CheckViolation: new row for relation "some_table" violates check constraint

Why it happens. The target Odoo version may introduce new UNIQUE constraints (e.g., unique email per company), new CHECK constraints (e.g., a field must be positive), or NOT NULL constraints on columns that previously allowed NULLs. Your production data, accumulated over years of use, may have duplicate values, invalid entries, or missing data that never caused issues in the old version.

A subtle variant: CHECK constraints in the target version may use type casts that do not exist on the source schema. For example, a constraint using ::jsonb will fail if the column is still varchar at the point when the constraint is validated.

How to fix it. For UNIQUE constraint violations, identify and merge or remove duplicate rows before the upgrade. For CHECK constraints, validate your data against the target version's constraints and fix violations in advance. Wrapping constraint validation in PostgreSQL savepoints is a practical pattern — it lets you test each constraint without crashing the entire migration if one fails.

8. Field translate type change (18 to 19)

Specific to the Odoo 18 to 19 upgrade, this issue causes mass corruption of field definitions if not handled correctly.

Why it happens. In Odoo 18, ir_model_fields.translate is a boolean column. In Odoo 19, it becomes a selection (varchar) with values like 'standard', 'html_translate', and NULL. The critical timing issue is that Odoo's loading code reads this column before any pre-migration hooks run. With the boolean column, the query WHERE translate IS NOT NULL returns every field (because false IS NOT NULL is true). This causes Odoo to treat every field as translated and attempt to convert all columns to JSONB.

How to fix it. The column type must be converted before Odoo starts, not in a pre-migration hook. This means performing the conversion in the migration runner script, outside of the Odoo process.

How OCU prevents these issues

OCU was built specifically to handle these problems. Every issue described above has a corresponding automated fix in the migration pipeline:

  • Foreign key cleanup. Pre-upgrade scan of all M2O, M2M, and existing FK constraints. Nullable references are set to NULL; non-nullable orphans are removed. Post-upgrade cleanup catches any new orphans created during the migration.
  • Module state reset. Automatic reset of all module states to installed after the upgrade completes.
  • View clearing. Inherited views have their arch_db cleared so Odoo reloads them from the new version's XML. Third-party module views are disabled. User-customized views (website builder changes) are detected and preserved.
  • ir_property conversion. Company-dependent columns are dropped before the upgrade. Post-migration populates the new JSONB columns from ir_property data.
  • Demo data handling. The ORM's _process_end is replaced with a raw SQL implementation that avoids the recomputation cascade entirely. UNIQUE constraints are temporarily suspended during the upgrade to prevent demo insertion conflicts.
  • Constraint validation. New constraints are validated using savepoints before the upgrade, and violating data is cleaned up automatically.
  • Translate field conversion. The boolean-to-selection conversion runs before Odoo starts, in the migration runner, preventing the mass JSONB conversion bug.

All of this runs automatically when you upload a backup. No manual SQL, no debugging, no repeated attempts. See how the full migration process works.

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 via foreign keys. The fix requires either disabling FK enforcement during the migration or pre-cleaning orphaned references before upgrading.
How do I fix "module is currently being processed" after upgrade?
This error means one or more modules are stuck in the "to upgrade" or "to install" state. Connect to your PostgreSQL database and run: UPDATE ir_module_module SET state = 'installed' WHERE state IN ('to upgrade', 'to install'). Then restart Odoo. OCU handles this automatically after every migration.
Can I migrate Odoo with third-party modules installed?
Yes. During migration, third-party module data tables are preserved but their views are disabled to prevent conflicts with the new version's XML structure. After migration, install updated versions of your third-party modules compatible with the target Odoo version.
What should I do if my migration takes too long?
Long migration times are usually caused by large databases (over 5 GB), heavy transaction history, or extensive filestore. Consider archiving old records before migrating. You can also 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 intermediate versions — the database must go through each step (16→17→18→19) because each version applies schema changes that the next depends on. However, tools like OCU chain these steps automatically into a single operation. You upload a v16 backup and download a v19 result.

Further reading

Skip the troubleshooting. Migrate with confidence.

Free test migrations, unlimited runs. No credit card required.

Start your free test migration