Commit Graph

5 Commits (f4588878da8b77195cfa03285d47462f86134198)

Author SHA1 Message Date
Simone Orsi f4588878da Global pylint cleanup 2021-12-27 16:49:36 +02:00
Laurent Mignon (ACSONE) 0c1395a3d8 [FIX] Forward port module_auto_update refactoring from 9.0 2021-12-27 16:49:36 +02:00
Jairo Llopis 3f81cc8906 [REF] module_auto_update: Step 3, backwards compatibility
The previous implementation of this addon proved being extremely buggy:

- It supplied out of the box a enabled cron to update Odoo that didn't restart the server, which possibly meant that upgrades broke things.
- It overloaded standard Odoo upgrade methods that made i.e. installing an addon sometimes forced to upgrade all other addons in the database.
- The checksum system wasn't smart enough, and some files that didn't need a module upgrade triggered the upgrade.
- It was based on a dirhash library that was untested.
- Some updates were not detected properly.
- Storing a column into `ir.module.module` sometimes forbids uninstalling the addon.

Thanks to Stéphane Bidoul (ACSONE), now we have new methods to perform the same work in a safer and more stable way.

All I'm doing here is:

- Cron is disabled by default.
- Installed checksums are no longer saved at first install.
- Old installations should keep most functionality intact thanks to the migration script.
- Drop some duplicated tests.
- Allow module uninstallation by pre-removing the fields from ir.mode.model.
- When uninstalling the addon, the deprecated features will get removed for next installs always.

Besides that, fixes for the new implementation too:

- When uninstalling the addon, we remove the stored checksum data, so further installations work as if the addon was installed from scratch.
2021-12-27 16:49:36 +02:00
Stéphane Bidoul (ACSONE) a1f71e9ad6 [REF] module_auto_update: Step 2, add new API
This code comes from the module_checksum_upgrade proposal
at https://github.com/OCA/server-tools/pull/1176.

* [ADD] module_checksum_upgrade

It provides the core mechanism of module_auto_update without
the cron nor any change to the standard upgrade mechanism.
Instead it provides an API on which module_auto_update can build,
as well as a method which can be called from a script to run
the upgrade of modules for which the checksum has changed.

* [IMP] refactor module_auto_update

Make it depend on module_checksum_upgrade which provides
the core mechanisms of managing the checksums. module_auto_update
makes it automatic.

* [IMP] module_checksum_upgrade: better exclusion mechanism

Ignore files based on exclude patterns.
Ignore uninstalled languages.
Better default for patterns to ignore (*.pyc,*.pyo,*.pot,static/*)

For better control on the hashing mechanism implement our own:
it's quite easy, and the checksumdir module used previously had
no test.

* [MIG] module_auto_update: adapt to new checksum mechanism

* [IMP] module_checksum_upgrade: raise in case of
 incomplete upgrade

* [IMP] module_checksum_upgrade: improve default exclusion
 pattern

* [IMP] module_checksum_upgrade: control translations
 overwrite

* [IMP] module_checksum_upgrade: one more test

* [IMP] module_checksum_upgrade: credits [ci skip]
2021-12-27 16:49:36 +02:00
Jairo Llopis 015c18004d [REF] module_auto_update: Step 1, move all deprecated stuff to deprecated files
- Files are clearly suffixed with `_deprecated` so we know those features have no support nor migrations.
- Views are removed, since updating from UI was too buggy to support it anymore.
2021-12-27 16:49:36 +02:00