There's more...

In both the pre- and post-migration steps, you only have access to a cursor, which is not very convenient if you're used to Odoo environments. It can lead to unexpected results to use models at this stage, because in the pre-migration step, the add-on's models are not yet loaded and also, in the post-migration step, the models defined by add-ons that depend on the current add-on are not yet loaded either. However, if this is not a problem for you, either because you want to use a model that your add-on doesn't touch or a model for which you know that this issue is not a problem, you can create the environment you're used to by writing the following:

from odoo import api, SUPERUSER_ID 
 
def migrate(cr, version): 
    env = api.Environment(cr, SUPERUSER_ID, {}) 
    # env holds all currently loaded models 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset