Commit Graph

5 Commits (17a9ea368d9bb133ad5a84aaa227b8bc679a25e3)

Author SHA1 Message Date
Alexey Pelykh da5d5d892d [IMP] module_auto_update: UI button 2021-12-27 16:49:36 +02:00
Stéphane Bidoul (ACSONE) 4fe1c0a110 [MIG] module_auto_update from 11 to 12
Use tagged to mark post install tests as previous mechanism
seems to be broken.
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
Jairo Llopis 4f351b283b [MIG] module_auto_update: Migrate to v11 2021-12-27 16:49:36 +02:00
Brenton Hughes 890d8766e6 [ADD] module_auto_update: Create module (#882)
* [IMP] module_auto_update: Create new module
* Add checksum_dir and checksum_installed fields to ir.module.module
  * Add checksum_dir to compute current checksum of module directory
    in addons path
  * Add checksum_installed to store checksum of module directory
    when module was last installed or upgraded
* Use checksumdir Python library to compute module directory sha1
  hashes, ignoring pyc and pyo extensions
* Extend update_list method to compare modules' checksum_dir and
  checksum_installed, then change state of modules with differing
  checksums to 'to upgrade'
* Replace Apps/Updates menu item with menu item of same name, which
  updates apps list and displays tree view of ir.module.module
  records with state 'to upgrade'
* Extend create and write methods to store computed checksum_dir as
  checksum_installed during module installation and upgrade, and
  set checksum_installed to False on uninstall
* Use context to stop checksum_installed from being updated during
  upgrade/uninstall cancellation
* Add cron job to periodically check for module upgrades by
  comparing checksums, then perform any available upgrades
* Extend upgrade_module method (called by cron and 'Apply Scheduled
  Upgrades' menu item) to call update_list
* Add post_init_hook to store checksum_installed of existing
  modules
* Add test coverage

* [FIX] module_auto_update: Fix test broken by changes
* Use dummy module to test update_list method instead of
  module_auto_update
2021-12-27 16:49:36 +02:00