How oca/openupgrade works
Project Overview and Purpose
• OpenUpgrade is an open source tool designed to upgrade Odoo instances from one major version to another. It consists of two primary components:
– The openupgrade_framework: a module that integrates with Odoo’s server (via server‐wide modules) and provides functionality to help patch or adapt Odoo’s internal components during an upgrade.
– The openupgrade_scripts: a collection of migration analyses and scripts that perform specific upgrade tasks for individual Odoo modules.
• The README and file tree clearly indicate that the project is comprised of “addons” (Odoo modules) which, when combined, form a migration framework.
Main Components
a. Odoo Instance: Represent an Odoo server instance as the target system environment that needs upgrading.
b. OpenUpgrade Framework Component:
• The “odoo_patch” submodule and its modifications to Odoo’s core addons and API.
• The fact that it integrates at the server level (often via the “server_wide_modules” option).
c. OpenUpgrade Scripts Component:
• Pre-migration actions (e.g., pre-migration.py)
• Post-migration actions (e.g., post-migration.py)
• Analysis reports (“upgrade_analysis.txt” and “upgrade_analysis_work.txt”)
d. CI/CD and Quality Tools:
– Although secondary to the runtime architecture, include parts that indicate static analysis tools (e.g., pre-commit configurations, GitHub workflows, lint configurations) which feed into continuous integration.
e. Documentation and Metadata:
– A component for documentation (both docsource and build_openupgrade_docs) to indicate that there is external documentation that explains migration policies and processes.
f. Configuration Files and Package Managers:
– Represent configuration files (e.g., setup, pyproject.toml, requirements.txt) that link to build and dependency-management aspects of the project.
Relationships and Interactions
– “Pre-migration analysis” → “Script Execution” → “Odoo Instance Upgrade Process”
– “Post-migration routines” → “Verification and Logging” (which can be tied to CI/CD output).
Architectural Patterns and Design Principles
• Dependency inversion is evident: the scripts depend on a stable core (framework) that abstracts Odoo’s internal changes.
Technologies and Tools
– Python, Odoo, and perhaps references to configuration management (e.g., pre-commit, GitHub Actions).
• Mention that the scripts often handle XML, Python migrations, and analysis text files. This indicates that file-driven workflow elements are part of the migration automation.
Final Remarks
• The goal is to capture the “flow” of an upgrade: starting from reading the module-specific migration analysis, processing it through the migration scripts, leveraging the framework to patch Odoo internals, and resulting in an upgraded Odoo instance.