Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
814 Näkymät

After modifying module fields, if there is already data inside, do I have to perform a migration? I often encounter data mismatch errors during automation.

in Odoo 17 Community Edition

Avatar
Hylkää
Paras vastaus

If you are modifying field names, structure or calculation logic for stored fields, you will meed to update the data somehow.

if you are updating via the interface, you can connect with the odoo shell (odoo-bin shell) and perform your transformations there.

If you make your modifications in a module, you can include a migrations directory in the module with a subfolder named after the version to which you are updating. This is the version you put in your manifest and should be incremented relative to past installations. I recommend looking for example migration scripts in the codebase, often in files named post_migrate.py.

The Odoo documentation on migration scripts is here:

https://www.odoo.com/documentation/17.0/developer/reference/upgrades/upgrade_scripts.html

You may also want to check out the OpenUpgrade library from the OCA as it provides many useful helpers.

https://github.com/OCA/openupgradelib

Best of luck!

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
maalisk. 15
6316
3
heinäk. 25
1978
3
toukok. 25
3458
0
helmik. 25
1251
0
tammik. 25
1089