Skip to content
Odoo Upgrade

How to Preserve Historical Transaction Data During an Odoo Upgrade

Learn how to safely preserve historical transaction data during an Odoo version upgrade. This guide covers database strategies, schema changes, testing, and rollback plans to ensure data integrity and business continuity.

5 min readSysGenPro Editorial
How to Preserve Historical Transaction Data During an Odoo Upgrade

Direct Answer: Preserving Historical Data in Odoo Upgrades

To preserve historical transaction data during an Odoo upgrade, you must execute a comprehensive strategy that combines verified database backups, rigorous schema compatibility analysis, and extensive testing in a representative staging environment. The primary risk is not the upgrade script itself, but the interaction between existing data structures, custom code, and third-party modules that may rely on deprecated fields or APIs. By isolating the upgrade process, validating data integrity through reconciliation checks, and establishing a clear rollback plan, organizations can ensure that financial records, operational history, and audit trails remain intact. This approach protects business continuity and maintains the long-term maintainability of the ERP system.

Assessing Source and Target Version Compatibility

The first step in any Odoo upgrade is a detailed assessment of the source and target versions. Odoo releases new major versions annually, and each version introduces changes to the Object-Relational Mapping (ORM) layer, database schema, and module dependencies. It is critical to verify the official upgrade path supported by the Odoo community or enterprise team. Not all version jumps are directly supported; for example, upgrading from Odoo 14 to Odoo 17 may require intermediate steps or specific migration scripts. You must consult the official Odoo documentation for the exact source and target versions to understand known issues, deprecated features, and required prerequisites. This assessment should include a review of all installed modules, both standard and custom, to identify potential conflicts.

Reviewing Module Dependencies

Custom modules and third-party add-ons are the most common sources of upgrade failures. Each module must be checked for compatibility with the target version. This involves reviewing the module's manifest file, checking for deprecated API calls, and verifying that all dependencies are available in the target version. If a module is not compatible, you must decide whether to refactor the code, find an alternative, or remove the module. This decision should be made early in the project to allow sufficient time for development and testing. Document all decisions and their rationale to maintain an audit trail.

Database Backup and Restore Testing

Before initiating any upgrade, you must create a full backup of the Odoo database. Odoo uses PostgreSQL as its database engine, so you should use PostgreSQL-specific backup tools such as pg_dump. A logical backup is generally preferred for portability, but a physical backup may be faster for large databases. Crucially, you must test the restore process. A backup is only as good as its ability to be restored. Perform a test restore to a separate environment and verify that the database is consistent and accessible. This step ensures that you have a reliable rollback point if the upgrade fails. Additionally, consider backing up the file system, including attachments and static files, as these are not part of the database backup.

Validating Backup Integrity

After creating the backup, validate its integrity by checking the file size, checksum, and performing a test restore. Verify that the restored database contains the same number of records as the source database. Use SQL queries to count records in key tables such as account_move, sale_order, and stock_move. This validation step helps identify any corruption or incomplete backups before you proceed with the upgrade. Store the backup in a secure, off-site location to protect against hardware failure or accidental deletion.

Preparing the Staging Environment

A representative staging environment is essential for testing the upgrade. This environment should mirror the production environment in terms of hardware, software, and data volume. Use a copy of the production database, anonymizing sensitive data if necessary to comply with privacy regulations. Install the target version of Odoo in the staging environment and apply the upgrade scripts. This allows you to identify and resolve issues in a controlled setting before impacting production. The staging environment should be used for functional testing, performance testing, and user acceptance testing. Ensure that all custom modules and integrations are present in the staging environment to accurately simulate the production setup.

Simulating Production Workloads

To ensure that the upgraded system can handle production workloads, simulate typical user activities in the staging environment. This includes creating new transactions, running reports, and executing batch jobs. Monitor system performance, including response times, database query performance, and resource utilization. Identify any performance regressions and address them before the production upgrade. This step helps prevent downtime and user frustration after the upgrade. Use monitoring tools to track key metrics and establish baselines for comparison.

Executing the Upgrade Process

The upgrade process involves running the Odoo upgrade scripts, which modify the database schema and update the application code. This process can take several hours depending on the size of the database and the number of modules installed. Schedule the upgrade during a maintenance window to minimize business impact. Before starting the upgrade, ensure that all users are logged out and that no background jobs are running. Monitor the upgrade logs closely for errors or warnings. If the upgrade fails, you can roll back to the pre-upgrade state using the backup. After the upgrade, restart the Odoo service and verify that the system is operational.

Monitoring Upgrade Logs

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