← Back to team overview

openerp-community team mailing list archive

Re: Migrate from OpenERP V7.0 Custom to OpenERP SAAS-2 Custom

 

> I think Olivier Dony once said there was an scriptable upgrade feature
> already in the ORM, we should really start enforcing its use on OCA
> branhces. Does someone know how it works?

Have a look at the banking addons: http://bazaar.launchpad.net/~banking-addons-team/banking-addons/banking-addons-70/view/head:/account_banking/migrations/6.1.0.1.81/post-set-statement-line-state.py

Create a folder named 'migrations' and subfolders with the full version 
numbers (openerpversion.moduleversion) you need a migration for. Then add files 
that declare a function named 'migrate' and do what you need to do there.

The migration script(s) will be run when you upgrade an addon from a lower 
version number (version field in ir_modules) to one that is greater than or 
equal to the version number the folder name consists of.

This mechanism is also used by the openupgrade project, so you can have a look 
there too. But beware, openupgrade pimps the mechanism a bit by providing some 
helper functions not available in stock openerp, so be careful when borrowing 
code there.

-- 
Therp - Maatwerk in open ontwikkeling

Holger Brunn - Ontwerp en implementatie

mail: holger@xxxxxxxx
web: http://therp.nl

Attachment: signature.asc
Description: This is a digitally signed message part.


References