Skip to content
Odoo Migration

Odoo Migration: Dealing with Deprecated Fields and Obsolete Database Columns

A practical guide for CIOs and ERP consultants on identifying, mapping, and resolving deprecated fields and obsolete database columns during Odoo version upgrades to ensure data integrity and system stability.

8 min readSysGenPro Editorial
Odoo Migration: Dealing with Deprecated Fields and Obsolete Database Columns

Direct Approach to Handling Deprecated Fields and Obsolete Columns

When migrating Odoo to a newer version, the primary challenge is managing the lifecycle of data structures that have been deprecated or removed. The recommended approach is a proactive audit of the database schema and custom code before executing the upgrade. This involves identifying all fields marked as deprecated in the source version, mapping them to their replacements in the target version, and planning for the safe removal of obsolete database columns. Ignoring these changes leads to data loss, broken custom modules, and system instability. The main risks to control are silent data truncation, failed module installations due to schema mismatches, and integration failures caused by changed API contracts. By treating schema evolution as a critical path item, you protect business continuity and ensure the long-term maintainability of your ERP environment.

Preparation: Auditing Source and Target Schemas

The preparation phase begins with a comprehensive audit of both the source and target Odoo versions. You must compare the database schemas to identify fields that exist in the source but are marked as deprecated or removed in the target. This requires access to the official Odoo documentation for the specific source and target versions, as compatibility and deprecation timelines vary significantly between releases. Do not assume that a field deprecated in one version remains available in the next. Create a detailed mapping document that lists every deprecated field, its corresponding replacement field (if any), and the data transformation logic required. For fields with no direct replacement, decide whether to archive the data, migrate it to a custom legacy table, or discard it based on business requirements. This audit also extends to custom modules, where you must review the code for references to deprecated fields or APIs. Any custom code that relies on obsolete structures must be refactored before the upgrade to prevent installation failures.

Identifying Obsolete Database Columns

Obsolete database columns are physical columns in the PostgreSQL database that are no longer referenced by the Odoo ORM or any active module. These columns often accumulate over time due to previous upgrades or abandoned customizations. While they do not immediately break the system, they increase database size, slow down queries, and complicate future migrations. To identify them, use database introspection tools to list all columns in the relevant tables and cross-reference them with the current Odoo model definitions. Columns that are not present in the ORM definition and are not used by any custom module or external integration are candidates for removal. However, removal should only occur after thorough validation to ensure no hidden dependencies exist. Document all identified obsolete columns and their status (to be kept, migrated, or dropped) in your migration plan.

Technical Execution: Data Mapping and Transformation

Once the audit is complete, the technical execution phase focuses on data mapping and transformation. For each deprecated field, you must define a transformation rule that moves the data to the new field or structure. This may involve simple renaming, data type conversion, or complex logic to split or merge data. For example, a deprecated 'partner_type' field might need to be mapped to a new 'contact_type' field with different value sets. Write custom migration scripts or use Odoo's built-in upgrade mechanisms to apply these transformations. It is critical to test these scripts in a staging environment that mirrors the production database. Run the migration scripts multiple times to ensure idempotency, meaning that running the script again does not corrupt the data. Validate the transformed data by comparing record counts and sample values between the source and target fields. Any discrepancies must be resolved before proceeding to the next step.

Refactoring Custom Modules

Custom modules are the most common source of migration failures when dealing with deprecated fields. You must refactor all custom code to remove references to deprecated fields and APIs. This includes updating model definitions, views, security rules, and business logic. Use static code analysis tools to scan your custom modules for deprecated identifiers. Replace them with the new equivalents defined in the target version. If a custom module depends on a third-party add-on that has not been updated for the target version, you must either find an updated version, replace the add-on, or rewrite the functionality in-house. Test the refactored modules in the staging environment to ensure they install correctly and function as expected. Pay special attention to security rules, as changes in field names or model structures can inadvertently expose sensitive data or block legitimate access.

Validation: Testing Data Integrity and Functionality

Validation is the most critical phase of the migration. You must perform rigorous testing to ensure that data integrity is maintained and that the system functions correctly after the upgrade. Start with unit tests for the migration scripts to verify that data transformations are accurate. Then, perform integration tests to ensure that custom modules and third-party add-ons work together without errors. Conduct end-to-end business process tests to simulate real-world scenarios, such as creating a sales order, processing an invoice, and updating inventory. Verify that data flows correctly through the system and that no deprecated fields are being accessed. Check the database for any remaining obsolete columns and ensure that they have been handled according to the migration plan. Perform reconciliation checks by comparing key financial and operational metrics between the source and target systems. Any discrepancies must be investigated and resolved before proceeding to deployment.

Deployment: Cutover and Rollback Planning

The deployment phase involves executing the migration in the production environment. This should be done during a planned downtime window to minimize business impact. Before starting, take a full backup of the production database and verify that the backup can be restored. Execute the migration scripts and upgrade the Odoo version. Monitor the system closely for any errors or warnings. If any critical issues arise, such as data loss or system instability, trigger the rollback plan. The rollback plan should involve restoring the database from the backup and reverting the Odoo version to the source version. Document the cutover process in a detailed runbook that includes step-by-step instructions, responsible roles, and go/no-go criteria. The go/no-go decision should be based on the results of the validation phase and any final checks performed immediately before cutover. Ensure that all stakeholders are informed of the cutover schedule and any potential impacts on business operations.

Stabilization: Post-Migration Monitoring and Support

After the migration is complete, the system enters the stabilization phase. This period is critical for identifying and resolving any issues that were not caught during testing. Monitor the system for performance regressions, error logs, and user complaints. Pay special attention to areas where deprecated fields were replaced, as these are likely to have hidden dependencies. Provide additional support to users during this period to help them adapt to any changes in the user interface or business processes. Collect feedback from users and stakeholders to identify any gaps in the migration. Address any issues promptly and document the resolutions. Once the system is stable, decommission the old database and any temporary migration scripts. Update the documentation to reflect the new schema and any changes to custom modules. This ensures that the system is well-documented and maintainable for future upgrades.

Risk Management: Mitigating Common Pitfalls

Several common pitfalls can derail an Odoo migration. One of the most significant is assuming that deprecated fields will be automatically migrated. In reality, Odoo does not always handle data migration for deprecated fields, especially in custom modules. Another pitfall is failing to test custom modules in a staging environment that accurately mirrors production. Differences in data volume or configuration can lead to unexpected issues. Additionally, ignoring obsolete database columns can lead to performance degradation over time. To mitigate these risks, adopt a rigorous testing strategy, use representative staging environments, and perform regular database maintenance. Ensure that all stakeholders are aligned on the migration goals and risks. By proactively managing these risks, you can ensure a smooth and successful migration.

Decision Criteria for Field Removal

Field StatusActionRisk LevelResponsible Role
Deprecated with ReplacementMap and migrate data to new fieldMediumERP Developer
Deprecated without ReplacementArchive data or discard based on business needHighBusiness Analyst
Obsolete ColumnDrop column after validationLowDatabase Administrator
Custom FieldRefactor code to use new APIHighCustom Module Developer

Conclusion: Ensuring Long-Term Maintainability

Dealing with deprecated fields and obsolete database columns is a critical aspect of Odoo migration. By following a structured approach that includes thorough auditing, careful data mapping, rigorous testing, and proactive risk management, you can ensure a successful upgrade. The key is to treat schema evolution as a first-class citizen in your migration plan, rather than an afterthought. This not only protects your data integrity but also improves the long-term maintainability of your ERP system. As you plan your next Odoo upgrade, remember to verify all compatibility details against the official vendor documentation for your specific source and target versions. By doing so, you can minimize risks and maximize the value of your ERP investment.

Written by
SysGenPro Editorial

SysGenPro Editorial

Platform & solutions team

Practical guidance on ERP, AI automation, cloud deployment and enterprise transformation from the SysGenPro team.

Share this article

Frequently asked questions

Common questions on this topic. Talk to our team for anything specific to your business.

01What happens to data in deprecated Odoo fields during an upgrade?

Data in deprecated fields is not automatically migrated by Odoo. You must manually map and transform the data to the new fields or structures. If not handled, the data may be lost or become inaccessible.

02How do I identify obsolete columns in my Odoo database?

Use database introspection tools to list all columns and cross-reference them with the current Odoo model definitions. Columns not referenced by the ORM or any active module are candidates for removal.

03Can I keep deprecated fields in Odoo after an upgrade?

No, deprecated fields are removed from the ORM in the new version. Keeping them requires custom code to maintain the database columns, which is not recommended and can lead to future compatibility issues.

04What is the risk of ignoring deprecated field warnings in Odoo?

Ignoring these warnings can lead to data loss, broken custom modules, and system instability. It also increases technical debt, making future upgrades more difficult and risky.

05How do custom modules affect Odoo database schema changes?

Custom modules often reference specific fields and APIs. If these are deprecated or removed, the custom modules will fail to install or function correctly. They must be refactored to use the new structures.

06Is it safe to drop obsolete columns manually in Odoo?

Yes, but only after thorough validation to ensure no hidden dependencies exist. Always take a backup before dropping columns and test the system in a staging environment first.

Continue learning
View all articles
Explore the platform

Where to go next

Browse the knowledge hub

See how SysGenPro fits your business

Discuss your workflows, modules and deployment options with our team.

Back to resources