Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Odoo Migrations

Tags:

I have some modules which expand add-ons of Odoo. For example, models in my_module which expand crm:

class Lead(models.Model):
    _inherit = 'crm.lead'
    # exmaple fields
    field_1 = fields.Char(...)
    field_2 = fields.Many2one(...)
    # ... field 99


class Stage(models.Model):
    _inherit = 'crm.stage'
    # exmaple fields
    field_1 = fields.Char(...)
    field_2 = fields.Many2one(...)
    # ... field 99

The same situation is for modules which expand hr, product, etc. I need to make some changes to the models. For example, in my_module_1, I need to change a couple of fields(type, relation), in my_module_2, just to remove a few fields etc. Of course I also need to change views of each module. And of course I have my custom models which have dependencies with models from different apps/modules. But I have data on production which must be stored. I did not find any information about migrations(or synchronization of modules) in Odoo.

My question is: What is the best way to update modules/apps on production(if we have many changes in fields of models and views)? Thanks in advance.

like image 649
Danila Ganchar Avatar asked Jan 05 '16 18:01

Danila Ganchar


People also ask

What is migration in Odoo?

Functional Odoo 14. Migration is the process of shifting from one platform to another. It can either be the upgrading of the software platform or the transfer of data from one platform to another. Migration is used in different situations in software platforms.

How do I transfer data from Odoo to Quickbooks?

Import the Chart of Account Once your templates are ready, go to Odoo > List of Records (Chart of accounts) > Click on import > Check the data mapping > Click on test import > then Import.


1 Answers

My question is: What is the best way to update modules/apps on production(if we have many changes in fields of models and views)?

While this question has been around for a while I cannot see any canonical answer therefore here are my two cents.

The problem of migration from one version to another in Odoo is rather common and definitely complicated. With that in mind the OpenUpgrade project has been created. OpenUpgrade is basically an upgrade path that will help you transform your data and models from version A to version B. For example if a field named fieldA has had its type changed on version 9 and you are on version 8, OpenUpgrade will take care of this by doing the necessary transformations.

OpenUpgrade also gives you the possibility to create your own migration scripts that will do whatever needs to be done in order for your module to be forward ported (or back ported) in various versions. For the standard modules these scripts have already been written to an extend, but for your own you might need to do some writing.

I suggest that you take a look at the documentation above, this is basically your first stop when we talk about migrations in Odoo.


like image 66
George Daramouskas Avatar answered Sep 29 '22 14:09

George Daramouskas