Enable Dark Mode!
overview-of-database-migration-in-odoo.jpg
By: Vishnu KP

Overview of Database Migration in Odoo

Technical Odoo 18

Migrating an Odoo database from one version to another is not just a technical necessity—it’s a strategic move that ensures your system remains secure, efficient, and feature-rich. However, the process is far from trivial. With each Odoo release, there are significant changes in the backend models, field structures, business logic, and even framework behavior. In this post, we’ll walk you through the critical considerations during an Odoo migration, combining practical experience with proven practices, with a particular focus on the pre-migration and post-migration phases.

Before migrating any data, your first responsibility is to analyze the models and fields in your current database and cross-check their presence in the target Odoo version.

Start by verifying whether each model used in your database still exists in the destination version. Odoo sometimes renames or merges models—for instance, a model like sale.order.line.invoice_status may be removed or replaced with a different approach. Similarly, check each field in your models. If any field is missing, determine if:

* The field was removed completely

* The field was renamed or replaced with a computed or related field

If the name is changed, you must update your modules, SQL statements, and Python logic accordingly.

Next, compare field data types between the current and target versions. This is especially important for technical fields and computed values. In some upgrades, for example, a Char or Text field may be converted to a jsonb type (like account.account.code becoming code_store in Odoo 17+). These changes demand an SQL-level update to transform the existing structure and populate the correct data format.

Your pre-migration script should:

* Detect and handle renamed or removed models/fields

* Adjust the schema for datatype changes (varchar > jsonb)

* Maintain relational integrity for foreign keys and many-to-many fields

Odoo doesn’t auto-fill computed fields during a raw database migration. After restructuring your models, you must run custom scripts to populate compute fields using their respective compute methods. For example, fields like amount_total, invoice_status, or display_name must be recomputed via the ORM or SQL scripts.

This step is crucial, as many views and business logics depend on these computed values.

During migration, it’s essential to review the views (form, tree, kanban, etc.) as some may be removed or significantly updated in the new version. Changes in models and fields can lead to view errors if not properly adjusted. In some cases, outdated views must be regenerated to align with the latest structure, especially when fields are renamed or deprecated. Always validate view rendering and user interface behavior post-migration.

Once the migration is done and the new schema is in place, the post-migration phase involves data cleanup, validation, and functional restoration.

After migration, thoroughly test all major workflows, including Sales, Purchase, Accounting, Inventory, CRM, and HR modules. Ensure that your business operations continue as planned. Pay close attention to:

* Computed values in views and reports

* Automated actions and server actions

* Scheduled jobs (cron tasks)

* User permissions and access rights

Before starting the migration, always take a complete backup of your database and filestore. Validate the backup on a test server to ensure it can be restored successfully. This backup is your fail-safe in case the migration introduces critical issues or data corruption.

In conclusion, Odoo database migration is not just about moving data—it's about restructuring and future-proofing your ERP system. With careful planning, deep understanding of Odoo's internal changes, and a clear process covering both pre- and post-migration stages, you can ensure a smooth upgrade path that minimizes risk and maximizes business value.

To read more about How Database Population Works in Odoo 18, refer to our blog How Database Population Works in Odoo 18.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment



whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message