[18.0][ADD] module_version_auto_upgrade
Make Odoo upgrade modules automatically when their version number changes, like Odoo.sh does.
Useful when adding fields to res.partner/res.users, which often breaks the UI (and as-of Odoo 18.0, keeping the module page open before restart no longer works)
@pedrobaeza just wondering if you have any guidance re testing for this module? the interesting part happens during Odoo (re)start, so I'm not sure if the regular self-testing approach will work
@ryanc-me I don't know how to test that at Odoo level, but I think you shouldn't reinvent the wheel, as this already exists through click-odoo-update, and the check is done through a checksum, not module version change (which is not the only indicator that something has changed, i. e., translations).
This was a tool we built internally - specifically to solve the res.users/res.partner issue. I think the main difference is, we can choose when to trigger a module upgrade automatically, by either updating/not the version. It also works as a drop-in (no external tools needed).
I do see your point though - maybe I can leave the PR open for some other feedback?
Yes. You also have https://github.com/OCA/server-tools/tree/18.0/module_auto_update for similar features.
After looking at those more, I think they solve a different issue.
Imagine the situation is:
- Odoo hosted on AWS Fargate or s/o (e.g., developer doesn't have shell access, Postgres is locked-down, etc)
- Developer has added a field to
res.users, so after a restart, the Odoo UI is broken (can't access apps page)
Neither click-odoo-upgrade nor module_auto_update helps in that case - they require container shell access, or require that the UI is working.
With this module, the dev can bump the module version, then the app is auto-upgraded, no other interaction/access needed
OK, as your prefer. I think the deployment strategy should include the auto-update, not to let Odoo to do that task, but anyway, if you explain the use case in the module, it's OK.