Replies: 4 comments 4 replies
-
Hi @yajo. Thanks for sharing. I'm not sure to understand all the advantage for such a change. You talk about the "impossibility to make a migration script that serves for multiple Odoo versions". Do you see any other advantage ? |
Beta Was this translation helpful? Give feedback.
-
Hola :) If that's the case, I wonder if we cannot propose a fix for it. I mean, why can't you support mig folder names to be w/ only 2 digits if the module's version is not 3 digits? Or... I don't get the rationale behind it :) |
Beta Was this translation helpful? Give feedback.
-
I'm not sure to understand what you propose :
|
Beta Was this translation helpful? Give feedback.
-
I’ll be upfront, I’m running on very little sleep and very long days the last week, so this might be me missing something obvious. If so, forgive me.. But whats the scenario where this something that is likely to popup? Or is this “just incase so it doesn’t cause footguns later”? |
Beta Was this translation helpful? Give feedback.
-
Currently, OCA's guidelines mandate that module versions use 5 numbers like in
a.b.x.y.z
. Thea.b
indicate the Odoo version. Thex.y.z
indicate the module version.After some diving on Odoo's migration system, it turns out that there are 2 kind of migration scripts:
Those that have 2
.
or more assume that the Odoo version is included. Example:migrations/15.0.0/pre-migrate.py
will only run on Odoo 15.0, when the module version is bigger than 0.Those that have 0-1
.
assume that the Odoo version is not included. Example:migrations/15.0/pre-migrate.py
will run on any Odoo version, if the module version is bigger than 15.0.There's also special support for folders named
0.0.0
, but that's out of scope.Since OCA's version indicators (without Odoo version) have 3 number positions, they have always 2 dots. Thus, it's impossible to make a migration script that serves for multiple Odoo versions.
Most odoo modules only use 2 numbers in their versions. I think OCA should follow that.
However, changing this would impact many tools, such as the docs, ocabot or pylint-odoo.
OTOH, maybe it's not so problematic, as long as this is a known behavior. Patch releases usually don't need to trigger migrations. But I think it's worth pointing out somewhere that that migration script folders should be named:
a.b.x[.y[.z]]
if you want version-specific migration scripts, orx.y
if you want to use the same migration script across multiple Odoo versions.Beta Was this translation helpful? Give feedback.
All reactions