Skip to content
Odoo Upgrade

Custom Code Refactoring Requirements for Odoo Version Upgrades

A practical guide to assessing, refactoring, and testing custom Odoo modules during version upgrades to minimize risk and ensure operational continuity.

4 min readSysGenPro Editorial
Custom Code Refactoring Requirements for Odoo Version Upgrades

Custom Code Refactoring Requirements for Odoo Version Upgrades

Custom code refactoring is a critical requirement for successful Odoo version upgrades because core APIs, ORM behaviors, and module structures change between major releases. The recommended approach involves a comprehensive assessment of all custom modules, identification of deprecated or changed dependencies, and systematic refactoring before the upgrade execution. This process minimizes the risk of broken functionality, data integrity issues, and operational downtime. Key risks to control include untested custom logic, incompatible third-party add-ons, and unverified database schema changes. By proactively refactoring custom code, organizations can ensure that their ERP system remains stable, secure, and maintainable after the upgrade. This guide provides a practical framework for planning, executing, and validating custom code refactoring during Odoo version upgrades.

Assessing Source and Target Version Compatibility

The first step in custom code refactoring is to assess the compatibility between the source and target Odoo versions. This involves reviewing the official release notes and migration guides for both versions to identify breaking changes, deprecated APIs, and new features. Organizations should document all custom modules, their dependencies, and the specific Odoo APIs they utilize. This assessment helps identify which modules require refactoring and which can be upgraded with minimal changes. It is essential to verify compatibility against the vendor's official documentation for the exact source and target versions, as compatibility claims may vary between community and enterprise editions.

Identifying Deprecated APIs and Changed Models

During the assessment, focus on identifying deprecated APIs and changed models that affect custom code. Odoo frequently updates its ORM, view inheritance mechanisms, and security rules, which can break custom modules if not properly refactored. Use static code analysis tools to scan custom modules for deprecated methods, removed fields, and changed model structures. Document all findings and prioritize refactoring tasks based on the impact on business processes and the complexity of the changes required.

Planning the Refactoring Strategy

A well-defined refactoring strategy is essential for managing the complexity of custom code changes. The strategy should include a detailed plan for each custom module, specifying the required changes, estimated effort, and responsible developers. Prioritize modules based on their criticality to business operations and the risk of failure if not refactored. Consider refactoring modules in phases, starting with the most critical and complex ones, to allow for iterative testing and validation. This approach reduces the risk of introducing new bugs and ensures that the refactoring process is manageable and well-documented.

Managing Third-Party Add-on Dependencies

Third-party add-ons often introduce additional complexity to the refactoring process. Organizations must verify the compatibility of each third-party module with the target Odoo version and assess whether the vendor provides updated versions or migration support. If a third-party module is not compatible, consider replacing it with a native Odoo feature or a compatible alternative. Document all decisions and ensure that the refactoring plan accounts for the integration of updated third-party modules. This step is crucial for maintaining the stability and functionality of the ERP system after the upgrade.

Executing Custom Code Refactoring

The execution phase involves implementing the planned refactoring changes in the custom modules. Developers should follow best practices for code quality, including writing clean, maintainable, and well-documented code. Use version control systems to track changes and facilitate collaboration among developers. Implement unit tests for each refactored module to ensure that the changes do not introduce new bugs. Regularly review code changes through peer reviews to maintain high standards of code quality and consistency. This phase requires close coordination between developers, testers, and business stakeholders to ensure that the refactored code meets functional and non-functional requirements.

Refactoring XML Views and Security Rules

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
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