From 52495d4931d703cab3b3915b17f64dcb41321c95 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 15 Jul 2022 09:17:13 +0000 Subject: [PATCH 1/6] README.rst --- module_auto_update/README.rst | 123 +++++ module_auto_update/__init__.py | 4 + module_auto_update/__manifest__.py | 22 + module_auto_update/addon_hash.py | 44 ++ module_auto_update/hooks.py | 11 + module_auto_update/i18n/ca.po | 50 ++ module_auto_update/i18n/cs_CZ.po | 75 +++ module_auto_update/i18n/de.po | 57 +++ module_auto_update/i18n/es.po | 63 +++ module_auto_update/i18n/es_MX.po | 51 ++ module_auto_update/i18n/fr.po | 75 +++ module_auto_update/i18n/hr.po | 51 ++ module_auto_update/i18n/it.po | 51 ++ .../i18n/module_auto_update.pot | 39 ++ module_auto_update/i18n/nl_NL.po | 51 ++ module_auto_update/i18n/pt_BR.po | 52 ++ module_auto_update/i18n/sl.po | 51 ++ module_auto_update/i18n/tr.po | 50 ++ module_auto_update/i18n/zh_CN.po | 48 ++ module_auto_update/models/__init__.py | 3 + module_auto_update/models/module.py | 198 ++++++++ module_auto_update/readme/CONFIGURE.rst | 9 + module_auto_update/readme/CONTRIBUTORS.rst | 6 + module_auto_update/readme/DESCRIPTION.rst | 4 + module_auto_update/readme/USAGE.rst | 22 + .../static/description/icon.png | Bin 0 -> 9455 bytes .../static/description/index.html | 465 ++++++++++++++++++ module_auto_update/tests/__init__.py | 4 + .../tests/sample_module/README.rst | 1 + .../tests/sample_module/data/f1.xml | 1 + .../tests/sample_module/data/f2.xml | 1 + .../tests/sample_module/i18n/en.po | 0 .../tests/sample_module/i18n/en_US.po | 0 .../tests/sample_module/i18n/fr.po | 0 .../tests/sample_module/i18n/fr_BE.po | 0 .../tests/sample_module/i18n/test.pot | 0 .../tests/sample_module/i18n_extra/en.po | 0 .../tests/sample_module/i18n_extra/fr.po | 0 .../tests/sample_module/i18n_extra/nl_NL.po | 0 .../tests/sample_module/models/stuff.py | 1 + .../tests/sample_module/models/stuff.pyc | Bin 0 -> 109 bytes .../tests/sample_module/models/stuff.pyo | Bin 0 -> 109 bytes .../tests/sample_module/static/src/some.js | 1 + module_auto_update/tests/test_addon_hash.py | 76 +++ module_auto_update/tests/test_module.py | 233 +++++++++ module_auto_update/views/ir_module_module.xml | 24 + 46 files changed, 2017 insertions(+) create mode 100644 module_auto_update/README.rst create mode 100644 module_auto_update/__init__.py create mode 100644 module_auto_update/__manifest__.py create mode 100644 module_auto_update/addon_hash.py create mode 100644 module_auto_update/hooks.py create mode 100644 module_auto_update/i18n/ca.po create mode 100644 module_auto_update/i18n/cs_CZ.po create mode 100644 module_auto_update/i18n/de.po create mode 100644 module_auto_update/i18n/es.po create mode 100644 module_auto_update/i18n/es_MX.po create mode 100644 module_auto_update/i18n/fr.po create mode 100644 module_auto_update/i18n/hr.po create mode 100644 module_auto_update/i18n/it.po create mode 100644 module_auto_update/i18n/module_auto_update.pot create mode 100644 module_auto_update/i18n/nl_NL.po create mode 100644 module_auto_update/i18n/pt_BR.po create mode 100644 module_auto_update/i18n/sl.po create mode 100644 module_auto_update/i18n/tr.po create mode 100644 module_auto_update/i18n/zh_CN.po create mode 100644 module_auto_update/models/__init__.py create mode 100644 module_auto_update/models/module.py create mode 100644 module_auto_update/readme/CONFIGURE.rst create mode 100644 module_auto_update/readme/CONTRIBUTORS.rst create mode 100644 module_auto_update/readme/DESCRIPTION.rst create mode 100644 module_auto_update/readme/USAGE.rst create mode 100644 module_auto_update/static/description/icon.png create mode 100644 module_auto_update/static/description/index.html create mode 100644 module_auto_update/tests/__init__.py create mode 100644 module_auto_update/tests/sample_module/README.rst create mode 100644 module_auto_update/tests/sample_module/data/f1.xml create mode 100644 module_auto_update/tests/sample_module/data/f2.xml create mode 100644 module_auto_update/tests/sample_module/i18n/en.po create mode 100644 module_auto_update/tests/sample_module/i18n/en_US.po create mode 100644 module_auto_update/tests/sample_module/i18n/fr.po create mode 100644 module_auto_update/tests/sample_module/i18n/fr_BE.po create mode 100644 module_auto_update/tests/sample_module/i18n/test.pot create mode 100644 module_auto_update/tests/sample_module/i18n_extra/en.po create mode 100644 module_auto_update/tests/sample_module/i18n_extra/fr.po create mode 100644 module_auto_update/tests/sample_module/i18n_extra/nl_NL.po create mode 100644 module_auto_update/tests/sample_module/models/stuff.py create mode 100644 module_auto_update/tests/sample_module/models/stuff.pyc create mode 100644 module_auto_update/tests/sample_module/models/stuff.pyo create mode 100644 module_auto_update/tests/sample_module/static/src/some.js create mode 100644 module_auto_update/tests/test_addon_hash.py create mode 100644 module_auto_update/tests/test_module.py create mode 100644 module_auto_update/views/ir_module_module.xml diff --git a/module_auto_update/README.rst b/module_auto_update/README.rst new file mode 100644 index 000000000..809901e18 --- /dev/null +++ b/module_auto_update/README.rst @@ -0,0 +1,123 @@ +================== +Module Auto Update +================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png + :target: https://odoo-community.org/page/development-status + :alt: Production/Stable +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github + :target: https://github.com/OCA/server-tools/tree/15.0/module_auto_update + :alt: OCA/server-tools +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/server-tools-15-0/server-tools-15-0-module_auto_update + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/149/15.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This addon provides mechanisms to compute sha1 hashes of installed addons, +and save them in the database. It also provides a method that exploits these +mechanisms to update a database by upgrading only the modules for which the +hash has changed since the last successful upgrade. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +This module supports the following system parameters: + +* ``module_auto_update.exclude_patterns``: comma-separated list of file + name patterns to ignore when computing addon checksums. Defaults to + ``*.pyc,*.pyo,i18n/*.pot,i18n_extra/*.pot,static/*``. + Filename patterns must be compatible with the python ``fnmatch`` function. + +In addition to the above pattern, .po files corresponding to languages that +are not installed in the Odoo database are ignored when computing checksums. + +Usage +===== + +The main method provided by this module is ``upgrade_changed_checksum`` +on ``ir.module.module``. It runs a database upgrade for all installed +modules for which the hash has changed since the last successful +run of this method. On success it saves the hashes in the database. + +The first time this method is invoked after installing the module, it +runs an upgrade of all modules, because it has not saved the hashes yet. +This is by design, priviledging safety. Should this be an issue, +the method ``_save_installed_checksums`` can be invoked in a situation +where one is sure all modules on disk are installed and up-to-date in the +database. + +To invoke the upgrade mechanism, navigate to *Apps* menu and use the +*Auto-Upgrade Modules* button, available only in developer mode. Restarting +the Odoo instance is highly recommended to minify risk of any possible issues. + +Another easy way to invoke this upgrade mechanism is by issuing the following +in an Odoo shell session: + +.. code-block:: python + + env['ir.module.module'].upgrade_changed_checksum() + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* LasLabs +* Juan José Scarafía +* Tecnativa +* ACSONE SA/NV + +Contributors +~~~~~~~~~~~~ + +* Brent Hughes +* Juan José Scarafía +* Jairo Llopis +* Stéphane Bidoul (https://acsone.eu) +* Eric Antones +* Manuel Engel + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/server-tools `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/module_auto_update/__init__.py b/module_auto_update/__init__.py new file mode 100644 index 000000000..c5d48b349 --- /dev/null +++ b/module_auto_update/__init__.py @@ -0,0 +1,4 @@ +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from . import models +from .hooks import uninstall_hook diff --git a/module_auto_update/__manifest__.py b/module_auto_update/__manifest__.py new file mode 100644 index 000000000..37b2f7915 --- /dev/null +++ b/module_auto_update/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2017 LasLabs Inc. +# Copyright 2018 Brainbean Apps (https://brainbeanapps.com) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +{ + "name": "Module Auto Update", + "summary": "Automatically update Odoo modules", + "version": "15.0.1.0.0", + "category": "Extra Tools", + "website": "https://github.com/OCA/server-tools", + "author": "LasLabs, " + "Juan José Scarafía, " + "Tecnativa, " + "ACSONE SA/NV, " + "Odoo Community Association (OCA)", + "license": "LGPL-3", + "installable": True, + "uninstall_hook": "uninstall_hook", + "depends": ["base"], + "data": ["views/ir_module_module.xml"], + "development_status": "Production/Stable", +} diff --git a/module_auto_update/addon_hash.py b/module_auto_update/addon_hash.py new file mode 100644 index 000000000..4027bcd89 --- /dev/null +++ b/module_auto_update/addon_hash.py @@ -0,0 +1,44 @@ +# Copyright 2018 ACSONE SA/NV. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +import hashlib +import os +from fnmatch import fnmatch + + +def _fnmatch(filename, patterns): + for pattern in patterns: + if fnmatch(filename, pattern): + return True + return False + + +def _walk(top, exclude_patterns, keep_langs): + keep_langs = {language.split("_")[0] for language in keep_langs} + for dirpath, dirnames, filenames in os.walk(top): + dirnames.sort() + reldir = os.path.relpath(dirpath, top) + if reldir == ".": + reldir = "" + for filename in sorted(filenames): + filepath = os.path.join(reldir, filename) + if _fnmatch(filepath, exclude_patterns): + continue + if keep_langs and reldir in {"i18n", "i18n_extra"}: + basename, ext = os.path.splitext(filename) + if ext == ".po": + if basename.split("_")[0] not in keep_langs: + continue + yield filepath + + +def addon_hash(top, exclude_patterns, keep_langs): + """Compute a sha1 digest of file contents.""" + m = hashlib.sha1() + for filepath in _walk(top, exclude_patterns, keep_langs): + # hash filename so empty files influence the hash + m.update(filepath.encode("utf-8")) + # hash file content + with open(os.path.join(top, filepath), "rb") as f: + m.update(f.read()) + return m.hexdigest() diff --git a/module_auto_update/hooks.py b/module_auto_update/hooks.py new file mode 100644 index 000000000..08e06ed8f --- /dev/null +++ b/module_auto_update/hooks.py @@ -0,0 +1,11 @@ +# Copyright 2017 LasLabs Inc. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from odoo import SUPERUSER_ID, api + +from .models.module import PARAM_INSTALLED_CHECKSUMS + + +def uninstall_hook(cr, registry): + env = api.Environment(cr, SUPERUSER_ID, {}) + env["ir.config_parameter"].set_param(PARAM_INSTALLED_CHECKSUMS, False) diff --git a/module_auto_update/i18n/ca.po b/module_auto_update/i18n/ca.po new file mode 100644 index 000000000..463286151 --- /dev/null +++ b/module_auto_update/i18n/ca.po @@ -0,0 +1,50 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * module_auto_update +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-21 02:43+0000\n" +"PO-Revision-Date: 2017-07-21 02:43+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: module_auto_update +#: model:ir.actions.server,name:module_auto_update.ir_module_module_upgrade_changed_checksum +#: model:ir.ui.menu,name:module_auto_update.menu_ir_module_module_upgrade_changed_checksum +msgid "Auto-Upgrade Modules" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__display_name +msgid "Display Name" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__id +msgid "ID" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module____last_update +msgid "Last Modified on" +msgstr "" + +#. module: module_auto_update +#: model:ir.model,name:module_auto_update.model_ir_module_module +msgid "Module" +msgstr "Mòdul" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__smart_search +msgid "Smart Search" +msgstr "" diff --git a/module_auto_update/i18n/cs_CZ.po b/module_auto_update/i18n/cs_CZ.po new file mode 100644 index 000000000..551f1b61b --- /dev/null +++ b/module_auto_update/i18n/cs_CZ.po @@ -0,0 +1,75 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * module_auto_update +# +# Translators: +# Lukáš Spurný , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-03-03 10:08+0000\n" +"PO-Revision-Date: 2018-03-03 10:08+0000\n" +"Last-Translator: Lukáš Spurný , 2018\n" +"Language-Team: Czech (Czech Republic) (https://www.transifex.com/oca/" +"teams/23907/cs_CZ/)\n" +"Language: cs_CZ\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" + +#. module: module_auto_update +#: model:ir.actions.server,name:module_auto_update.ir_module_module_upgrade_changed_checksum +#: model:ir.ui.menu,name:module_auto_update.menu_ir_module_module_upgrade_changed_checksum +msgid "Auto-Upgrade Modules" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__display_name +msgid "Display Name" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__id +msgid "ID" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module____last_update +msgid "Last Modified on" +msgstr "" + +#. module: module_auto_update +#: model:ir.model,name:module_auto_update.model_ir_module_module +msgid "Module" +msgstr "Modul" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__smart_search +msgid "Smart Search" +msgstr "" + +#~ msgid "Checksum Dir" +#~ msgstr "Kontrolní součet Dir" + +#~ msgid "Checksum Installed" +#~ msgstr "Kontrolní součet je nainstalován" + +#~ msgid "Module Upgrade" +#~ msgstr "Aktualizace modulů" + +#~ msgid "Perform Module Upgrades" +#~ msgstr "Provést aktualizaci modulů" + +#~ msgid "Modules" +#~ msgstr "Moduly" + +#~ msgid "Open Updates and Update Apps List Server Action" +#~ msgstr "Otevřít aktualizaci a aktualizovat seznam serverových akcí" + +#~ msgid "Scheduled Upgrades" +#~ msgstr "Plánované aktualizace" + +#~ msgid "Updates" +#~ msgstr "Aktualizace" diff --git a/module_auto_update/i18n/de.po b/module_auto_update/i18n/de.po new file mode 100644 index 000000000..d873fedec --- /dev/null +++ b/module_auto_update/i18n/de.po @@ -0,0 +1,57 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * module_auto_update +# +# Translators: +# Niki Waibel , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-21 02:43+0000\n" +"PO-Revision-Date: 2017-07-21 02:43+0000\n" +"Last-Translator: Niki Waibel , 2017\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: module_auto_update +#: model:ir.actions.server,name:module_auto_update.ir_module_module_upgrade_changed_checksum +#: model:ir.ui.menu,name:module_auto_update.menu_ir_module_module_upgrade_changed_checksum +msgid "Auto-Upgrade Modules" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__display_name +msgid "Display Name" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__id +msgid "ID" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module____last_update +msgid "Last Modified on" +msgstr "" + +#. module: module_auto_update +#: model:ir.model,name:module_auto_update.model_ir_module_module +msgid "Module" +msgstr "Modul" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__smart_search +msgid "Smart Search" +msgstr "" + +#~ msgid "Module Upgrade" +#~ msgstr "Modul aktualisieren" + +#, fuzzy +#~ msgid "Perform Module Upgrades" +#~ msgstr "Modul aktualisieren" diff --git a/module_auto_update/i18n/es.po b/module_auto_update/i18n/es.po new file mode 100644 index 000000000..3be219855 --- /dev/null +++ b/module_auto_update/i18n/es.po @@ -0,0 +1,63 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * module_auto_update +# +# Translators: +# OCA Transbot , 2018 +# enjolras , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-03-03 10:08+0000\n" +"PO-Revision-Date: 2018-03-03 10:08+0000\n" +"Last-Translator: enjolras , 2018\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: module_auto_update +#: model:ir.actions.server,name:module_auto_update.ir_module_module_upgrade_changed_checksum +#: model:ir.ui.menu,name:module_auto_update.menu_ir_module_module_upgrade_changed_checksum +msgid "Auto-Upgrade Modules" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__display_name +msgid "Display Name" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__id +msgid "ID" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module____last_update +msgid "Last Modified on" +msgstr "" + +#. module: module_auto_update +#: model:ir.model,name:module_auto_update.model_ir_module_module +msgid "Module" +msgstr "Módulo" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__smart_search +msgid "Smart Search" +msgstr "" + +#~ msgid "Module Upgrade" +#~ msgstr "Actualización de módulo" + +#~ msgid "Modules" +#~ msgstr "Módulos" + +#~ msgid "Scheduled Upgrades" +#~ msgstr "Actualizaciones programadas" + +#~ msgid "Updates" +#~ msgstr "Actualizaciones" diff --git a/module_auto_update/i18n/es_MX.po b/module_auto_update/i18n/es_MX.po new file mode 100644 index 000000000..d21bad084 --- /dev/null +++ b/module_auto_update/i18n/es_MX.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * module_auto_update +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-21 02:43+0000\n" +"PO-Revision-Date: 2017-07-21 02:43+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Spanish (Mexico) (https://www.transifex.com/oca/teams/23907/" +"es_MX/)\n" +"Language: es_MX\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: module_auto_update +#: model:ir.actions.server,name:module_auto_update.ir_module_module_upgrade_changed_checksum +#: model:ir.ui.menu,name:module_auto_update.menu_ir_module_module_upgrade_changed_checksum +msgid "Auto-Upgrade Modules" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__display_name +msgid "Display Name" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__id +msgid "ID" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module____last_update +msgid "Last Modified on" +msgstr "" + +#. module: module_auto_update +#: model:ir.model,name:module_auto_update.model_ir_module_module +msgid "Module" +msgstr "Módulo" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__smart_search +msgid "Smart Search" +msgstr "" diff --git a/module_auto_update/i18n/fr.po b/module_auto_update/i18n/fr.po new file mode 100644 index 000000000..319447d33 --- /dev/null +++ b/module_auto_update/i18n/fr.po @@ -0,0 +1,75 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * module_auto_update +# +# Translators: +# Nicolas JEUDY , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-03-03 10:08+0000\n" +"PO-Revision-Date: 2021-05-14 19:47+0000\n" +"Last-Translator: Yves Le Doeuff \n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: module_auto_update +#: model:ir.actions.server,name:module_auto_update.ir_module_module_upgrade_changed_checksum +#: model:ir.ui.menu,name:module_auto_update.menu_ir_module_module_upgrade_changed_checksum +msgid "Auto-Upgrade Modules" +msgstr "Mise à jour automatique des modules" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__id +msgid "ID" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module____last_update +msgid "Last Modified on" +msgstr "" + +#. module: module_auto_update +#: model:ir.model,name:module_auto_update.model_ir_module_module +msgid "Module" +msgstr "Module" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__smart_search +msgid "Smart Search" +msgstr "Recherche intelligente" + +#~ msgid "Checksum Dir" +#~ msgstr "Somme de contrôle du dossier" + +#~ msgid "Checksum Installed" +#~ msgstr "Somme de contrôle installée" + +#~ msgid "Module Upgrade" +#~ msgstr "Mise à niveau du module" + +#~ msgid "Perform Module Upgrades" +#~ msgstr "Appliquer les mise à jour de modules" + +#~ msgid "Modules" +#~ msgstr "Modules" + +#~ msgid "Open Updates and Update Apps List Server Action" +#~ msgstr "Afficher les mises à jour" + +#~ msgid "Scheduled Upgrades" +#~ msgstr "Planifier les mises à jour" + +#~ msgid "Updates" +#~ msgstr "Mises à jour" diff --git a/module_auto_update/i18n/hr.po b/module_auto_update/i18n/hr.po new file mode 100644 index 000000000..044265934 --- /dev/null +++ b/module_auto_update/i18n/hr.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * module_auto_update +# +# Translators: +# Bole , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-21 02:43+0000\n" +"PO-Revision-Date: 2017-07-21 02:43+0000\n" +"Last-Translator: Bole , 2017\n" +"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: module_auto_update +#: model:ir.actions.server,name:module_auto_update.ir_module_module_upgrade_changed_checksum +#: model:ir.ui.menu,name:module_auto_update.menu_ir_module_module_upgrade_changed_checksum +msgid "Auto-Upgrade Modules" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__display_name +msgid "Display Name" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__id +msgid "ID" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module____last_update +msgid "Last Modified on" +msgstr "" + +#. module: module_auto_update +#: model:ir.model,name:module_auto_update.model_ir_module_module +msgid "Module" +msgstr "Modul" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__smart_search +msgid "Smart Search" +msgstr "" diff --git a/module_auto_update/i18n/it.po b/module_auto_update/i18n/it.po new file mode 100644 index 000000000..bdf31c43c --- /dev/null +++ b/module_auto_update/i18n/it.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * module_auto_update +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-21 02:43+0000\n" +"PO-Revision-Date: 2021-11-29 11:45+0000\n" +"Last-Translator: Francesco Foresti \n" +"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: module_auto_update +#: model:ir.actions.server,name:module_auto_update.ir_module_module_upgrade_changed_checksum +#: model:ir.ui.menu,name:module_auto_update.menu_ir_module_module_upgrade_changed_checksum +msgid "Auto-Upgrade Modules" +msgstr "Aggiorna Moduli Automaticamente" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__display_name +msgid "Display Name" +msgstr "Nome da visualizzare" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__id +msgid "ID" +msgstr "ID" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: module_auto_update +#: model:ir.model,name:module_auto_update.model_ir_module_module +msgid "Module" +msgstr "Modulo" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__smart_search +msgid "Smart Search" +msgstr "Ricerca Smart" diff --git a/module_auto_update/i18n/module_auto_update.pot b/module_auto_update/i18n/module_auto_update.pot new file mode 100644 index 000000000..3246fc067 --- /dev/null +++ b/module_auto_update/i18n/module_auto_update.pot @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * module_auto_update +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: module_auto_update +#: model:ir.actions.server,name:module_auto_update.ir_module_module_upgrade_changed_checksum +#: model:ir.ui.menu,name:module_auto_update.menu_ir_module_module_upgrade_changed_checksum +msgid "Auto-Upgrade Modules" +msgstr "" + +#. module: module_auto_update +#: code:addons/module_auto_update/models/module.py:0 +#, python-format +msgid "Checksum upgrade complete." +msgstr "" + +#. module: module_auto_update +#: model:ir.model,name:module_auto_update.model_ir_module_module +msgid "Module" +msgstr "" + +#. module: module_auto_update +#: code:addons/module_auto_update/models/module.py:0 +#, python-format +msgid "" +"No checksum change detected in installed modules and all modules installed, " +"nothing to do." +msgstr "" diff --git a/module_auto_update/i18n/nl_NL.po b/module_auto_update/i18n/nl_NL.po new file mode 100644 index 000000000..478f0b30c --- /dev/null +++ b/module_auto_update/i18n/nl_NL.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * module_auto_update +# +# Translators: +# Peter Hageman , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-21 02:43+0000\n" +"PO-Revision-Date: 2017-07-21 02:43+0000\n" +"Last-Translator: Peter Hageman , 2017\n" +"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/" +"teams/23907/nl_NL/)\n" +"Language: nl_NL\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: module_auto_update +#: model:ir.actions.server,name:module_auto_update.ir_module_module_upgrade_changed_checksum +#: model:ir.ui.menu,name:module_auto_update.menu_ir_module_module_upgrade_changed_checksum +msgid "Auto-Upgrade Modules" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__display_name +msgid "Display Name" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__id +msgid "ID" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module____last_update +msgid "Last Modified on" +msgstr "" + +#. module: module_auto_update +#: model:ir.model,name:module_auto_update.model_ir_module_module +msgid "Module" +msgstr "Module" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__smart_search +msgid "Smart Search" +msgstr "" diff --git a/module_auto_update/i18n/pt_BR.po b/module_auto_update/i18n/pt_BR.po new file mode 100644 index 000000000..65aa4916d --- /dev/null +++ b/module_auto_update/i18n/pt_BR.po @@ -0,0 +1,52 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * module_auto_update +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-21 02:43+0000\n" +"PO-Revision-Date: 2019-08-30 14:37+0000\n" +"Last-Translator: Rodrigo Macedo \n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/" +"teams/23907/pt_BR/)\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.8\n" + +#. module: module_auto_update +#: model:ir.actions.server,name:module_auto_update.ir_module_module_upgrade_changed_checksum +#: model:ir.ui.menu,name:module_auto_update.menu_ir_module_module_upgrade_changed_checksum +msgid "Auto-Upgrade Modules" +msgstr "Módulos de atualização automática" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__display_name +msgid "Display Name" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__id +msgid "ID" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module____last_update +msgid "Last Modified on" +msgstr "" + +#. module: module_auto_update +#: model:ir.model,name:module_auto_update.model_ir_module_module +msgid "Module" +msgstr "Módulo" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__smart_search +msgid "Smart Search" +msgstr "" diff --git a/module_auto_update/i18n/sl.po b/module_auto_update/i18n/sl.po new file mode 100644 index 000000000..ab41d6aee --- /dev/null +++ b/module_auto_update/i18n/sl.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * module_auto_update +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-21 02:43+0000\n" +"PO-Revision-Date: 2017-07-21 02:43+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" + +#. module: module_auto_update +#: model:ir.actions.server,name:module_auto_update.ir_module_module_upgrade_changed_checksum +#: model:ir.ui.menu,name:module_auto_update.menu_ir_module_module_upgrade_changed_checksum +msgid "Auto-Upgrade Modules" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__display_name +msgid "Display Name" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__id +msgid "ID" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module____last_update +msgid "Last Modified on" +msgstr "" + +#. module: module_auto_update +#: model:ir.model,name:module_auto_update.model_ir_module_module +msgid "Module" +msgstr "Modul" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__smart_search +msgid "Smart Search" +msgstr "" diff --git a/module_auto_update/i18n/tr.po b/module_auto_update/i18n/tr.po new file mode 100644 index 000000000..21e79edb7 --- /dev/null +++ b/module_auto_update/i18n/tr.po @@ -0,0 +1,50 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * module_auto_update +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-21 02:43+0000\n" +"PO-Revision-Date: 2017-07-21 02:43+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Turkish (https://www.transifex.com/oca/teams/23907/tr/)\n" +"Language: tr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: module_auto_update +#: model:ir.actions.server,name:module_auto_update.ir_module_module_upgrade_changed_checksum +#: model:ir.ui.menu,name:module_auto_update.menu_ir_module_module_upgrade_changed_checksum +msgid "Auto-Upgrade Modules" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__display_name +msgid "Display Name" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__id +msgid "ID" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module____last_update +msgid "Last Modified on" +msgstr "" + +#. module: module_auto_update +#: model:ir.model,name:module_auto_update.model_ir_module_module +msgid "Module" +msgstr "Modül" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__smart_search +msgid "Smart Search" +msgstr "" diff --git a/module_auto_update/i18n/zh_CN.po b/module_auto_update/i18n/zh_CN.po new file mode 100644 index 000000000..3225e30d9 --- /dev/null +++ b/module_auto_update/i18n/zh_CN.po @@ -0,0 +1,48 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * module_auto_update +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-08-31 06:18+0000\n" +"Last-Translator: 黎伟杰 <674416404@qq.com>\n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.8\n" + +#. module: module_auto_update +#: model:ir.actions.server,name:module_auto_update.ir_module_module_upgrade_changed_checksum +#: model:ir.ui.menu,name:module_auto_update.menu_ir_module_module_upgrade_changed_checksum +msgid "Auto-Upgrade Modules" +msgstr "自动升级模块" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__display_name +msgid "Display Name" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__id +msgid "ID" +msgstr "" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module____last_update +msgid "Last Modified on" +msgstr "" + +#. module: module_auto_update +#: model:ir.model,name:module_auto_update.model_ir_module_module +msgid "Module" +msgstr "模块" + +#. module: module_auto_update +#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__smart_search +msgid "Smart Search" +msgstr "" diff --git a/module_auto_update/models/__init__.py b/module_auto_update/models/__init__.py new file mode 100644 index 000000000..99672cfeb --- /dev/null +++ b/module_auto_update/models/__init__.py @@ -0,0 +1,3 @@ +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from . import module diff --git a/module_auto_update/models/module.py b/module_auto_update/models/module.py new file mode 100644 index 000000000..b50bf1ccd --- /dev/null +++ b/module_auto_update/models/module.py @@ -0,0 +1,198 @@ +# Copyright 2017 LasLabs Inc. +# Copyright 2018 ACSONE SA/NV. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +import json +import logging +import os + +from odoo import _, api, exceptions, models, tools +from odoo.modules.module import get_module_path + +from ..addon_hash import addon_hash + +PARAM_INSTALLED_CHECKSUMS = "module_auto_update.installed_checksums" +PARAM_EXCLUDE_PATTERNS = "module_auto_update.exclude_patterns" +DEFAULT_EXCLUDE_PATTERNS = "*.pyc,*.pyo,i18n/*.pot,i18n_extra/*.pot,static/*" + +_logger = logging.getLogger(__name__) + + +class FailedUpgradeError(exceptions.UserError): + pass + + +class IncompleteUpgradeError(exceptions.UserError): + pass + + +def ensure_module_state(env, modules, state): + # read module states, bypassing any Odoo cache + if not modules: + return + env.cr.execute( + "SELECT name FROM ir_module_module " "WHERE id IN %s AND state != %s", + (tuple(modules.ids), state), + ) + names = [r[0] for r in env.cr.fetchall()] + if names: + raise FailedUpgradeError( + "The following modules should be in state '%s' " + "at this stage: %s. Bailing out for safety." + % ( + state, + ",".join(names), + ), + ) + + +class Module(models.Model): + _inherit = "ir.module.module" + + def _get_checksum_dir(self): + self.ensure_one() + + exclude_patterns = self.env["ir.config_parameter"].get_param( + PARAM_EXCLUDE_PATTERNS, + DEFAULT_EXCLUDE_PATTERNS, + ) + exclude_patterns = [p.strip() for p in exclude_patterns.split(",")] + keep_langs = self.env["res.lang"].search([]).mapped("code") + + module_path = get_module_path(self.name) + if module_path and os.path.isdir(module_path): + checksum_dir = addon_hash( + module_path, + exclude_patterns, + keep_langs, + ) + else: + checksum_dir = False + + return checksum_dir + + @api.model + def _get_saved_checksums(self): + Icp = self.env["ir.config_parameter"] + return json.loads(Icp.get_param(PARAM_INSTALLED_CHECKSUMS, "{}")) + + @api.model + def _save_checksums(self, checksums): + Icp = self.env["ir.config_parameter"] + Icp.set_param(PARAM_INSTALLED_CHECKSUMS, json.dumps(checksums)) + Icp.flush() + + @api.model + def _save_installed_checksums(self): + checksums = {} + installed_modules = self.search([("state", "=", "installed")]) + for module in installed_modules: + checksums[module.name] = module._get_checksum_dir() + self._save_checksums(checksums) + + @api.model + def _get_modules_partially_installed(self): + return self.search([("state", "in", ("to install", "to remove", "to upgrade"))]) + + @api.model + def _get_modules_with_changed_checksum(self): + saved_checksums = self._get_saved_checksums() + installed_modules = self.search([("state", "=", "installed")]) + return installed_modules.filtered( + lambda r: r._get_checksum_dir() != saved_checksums.get(r.name), + ) + + @api.model + def upgrade_changed_checksum(self, overwrite_existing_translations=False): + """Run an upgrade of the database, upgrading only changed modules. + + Installed modules for which the checksum has changed since the + last successful run of this method are marked "to upgrade", + then the normal Odoo scheduled upgrade process + is launched. + + If there is no module with a changed checksum, and no module in state + other than installed, uninstalled, uninstallable, this method does + nothing, otherwise the normal Odoo upgrade process is launched. + + After a successful upgrade, the checksums of installed modules are + saved. + + In case of error during the upgrade, an exception is raised. + If any module remains to upgrade or to uninstall after the upgrade + process, an exception is raised as well. + + Note: this method commits the current transaction at each important + step, it is therefore not intended to be run as part of a + larger transaction. + """ + _logger.info( + "Checksum upgrade starting (i18n-overwrite=%s)...", + overwrite_existing_translations, + ) + + tools.config[ + "overwrite_existing_translations" + ] = overwrite_existing_translations + + _logger.info("Updating modules list...") + self.update_list() + changed_modules = self._get_modules_with_changed_checksum() + if not changed_modules and not self._get_modules_partially_installed(): + _logger.info( + "No checksum change detected in installed modules " + "and all modules installed, nothing to do." + ) + + return { + "type": "ir.actions.client", + "tag": "display_notification", + "params": { + "message": _( + "No checksum change detected in installed modules " + "and all modules installed, nothing to do." + ), + "type": "success", + "sticky": False, + }, + } + + _logger.info( + "Marking the following modules to upgrade, " + "for their checksums changed: %s...", + ",".join(changed_modules.mapped("name")), + ) + changed_modules.button_upgrade() + self.env.cr.commit() # pylint: disable=invalid-commit + # in rare situations, button_upgrade may fail without + # exception, this would lead to corruption because + # no upgrade would be performed and save_installed_checksums + # would update cheksums for modules that have not been upgraded + ensure_module_state(self.env, changed_modules, "to upgrade") + + _logger.info("Upgrading...") + self.env["base.module.upgrade"].upgrade_module() + self.env.cr.commit() # pylint: disable=invalid-commit + + _logger.info("Upgrade successful, updating checksums...") + self._save_installed_checksums() + self.env.cr.commit() # pylint: disable=invalid-commit + + partial_modules = self._get_modules_partially_installed() + if partial_modules: + raise IncompleteUpgradeError( + "Checksum upgrade successful " + "but incomplete for the following modules: %s" + % ",".join(partial_modules.mapped("name")) + ) + + _logger.info("Checksum upgrade complete.") + return { + "type": "ir.actions.client", + "tag": "display_notification", + "params": { + "message": _("Checksum upgrade complete."), + "type": "success", + "sticky": False, + }, + } diff --git a/module_auto_update/readme/CONFIGURE.rst b/module_auto_update/readme/CONFIGURE.rst new file mode 100644 index 000000000..b46e74563 --- /dev/null +++ b/module_auto_update/readme/CONFIGURE.rst @@ -0,0 +1,9 @@ +This module supports the following system parameters: + +* ``module_auto_update.exclude_patterns``: comma-separated list of file + name patterns to ignore when computing addon checksums. Defaults to + ``*.pyc,*.pyo,i18n/*.pot,i18n_extra/*.pot,static/*``. + Filename patterns must be compatible with the python ``fnmatch`` function. + +In addition to the above pattern, .po files corresponding to languages that +are not installed in the Odoo database are ignored when computing checksums. diff --git a/module_auto_update/readme/CONTRIBUTORS.rst b/module_auto_update/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..d62dca127 --- /dev/null +++ b/module_auto_update/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +* Brent Hughes +* Juan José Scarafía +* Jairo Llopis +* Stéphane Bidoul (https://acsone.eu) +* Eric Antones +* Manuel Engel diff --git a/module_auto_update/readme/DESCRIPTION.rst b/module_auto_update/readme/DESCRIPTION.rst new file mode 100644 index 000000000..1c1cd09b1 --- /dev/null +++ b/module_auto_update/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +This addon provides mechanisms to compute sha1 hashes of installed addons, +and save them in the database. It also provides a method that exploits these +mechanisms to update a database by upgrading only the modules for which the +hash has changed since the last successful upgrade. diff --git a/module_auto_update/readme/USAGE.rst b/module_auto_update/readme/USAGE.rst new file mode 100644 index 000000000..8b3d386ea --- /dev/null +++ b/module_auto_update/readme/USAGE.rst @@ -0,0 +1,22 @@ +The main method provided by this module is ``upgrade_changed_checksum`` +on ``ir.module.module``. It runs a database upgrade for all installed +modules for which the hash has changed since the last successful +run of this method. On success it saves the hashes in the database. + +The first time this method is invoked after installing the module, it +runs an upgrade of all modules, because it has not saved the hashes yet. +This is by design, priviledging safety. Should this be an issue, +the method ``_save_installed_checksums`` can be invoked in a situation +where one is sure all modules on disk are installed and up-to-date in the +database. + +To invoke the upgrade mechanism, navigate to *Apps* menu and use the +*Auto-Upgrade Modules* button, available only in developer mode. Restarting +the Odoo instance is highly recommended to minify risk of any possible issues. + +Another easy way to invoke this upgrade mechanism is by issuing the following +in an Odoo shell session: + +.. code-block:: python + + env['ir.module.module'].upgrade_changed_checksum() diff --git a/module_auto_update/static/description/icon.png b/module_auto_update/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)( z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(#B1j35xPnPW z*bMSSOauW>o;*=kO8ojw91VX!qoOQb)zHJ!odWB}d+*K?#sY_jqPdg{Sm2HdYzdEx zOGVPhVRTGPtv0o}RfVP;Nd(|CB)I;*t&QO8h zFfekr30S!-LHmV_Su-W+rEwYXJ^;6&3|L$mMC8*bQptyOo9;>Qb9Q9`ySe3%V$A*9 zeKEe+b0{#KWGp$F+tga)0RtI)nhMa-K@JS}2krK~n8vJ=Ngm?R!9G<~RyuU0d?nz# z-5EK$o(!F?hmX*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P1&t@y?5rvg<}E+GB}26NYPp4f2YFQrQtot5mn3wu_qprZ=>Ig-$ zbW26Ws~IgY>}^5w`vTB(G`PTZaDiGBo5o(tp)qli|NeV( z@H_=R8V39rt5J5YB2Ky?4eJJ#b`_iBe2ot~6%7mLt5t8Vwi^Jy7|jWXqa3amOIoRb zOr}WVFP--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4 z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/module_auto_update/static/description/index.html b/module_auto_update/static/description/index.html new file mode 100644 index 000000000..8908e56a0 --- /dev/null +++ b/module_auto_update/static/description/index.html @@ -0,0 +1,465 @@ + + + + + + +Module Auto Update + + + +
+

Module Auto Update

+ + +

Production/Stable License: LGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

+

This addon provides mechanisms to compute sha1 hashes of installed addons, +and save them in the database. It also provides a method that exploits these +mechanisms to update a database by upgrading only the modules for which the +hash has changed since the last successful upgrade.

+

Table of contents

+ +
+

Configuration

+

This module supports the following system parameters:

+
    +
  • module_auto_update.exclude_patterns: comma-separated list of file +name patterns to ignore when computing addon checksums. Defaults to +*.pyc,*.pyo,i18n/*.pot,i18n_extra/*.pot,static/*. +Filename patterns must be compatible with the python fnmatch function.
  • +
+

In addition to the above pattern, .po files corresponding to languages that +are not installed in the Odoo database are ignored when computing checksums.

+
+
+

Usage

+

The main method provided by this module is upgrade_changed_checksum +on ir.module.module. It runs a database upgrade for all installed +modules for which the hash has changed since the last successful +run of this method. On success it saves the hashes in the database.

+

The first time this method is invoked after installing the module, it +runs an upgrade of all modules, because it has not saved the hashes yet. +This is by design, priviledging safety. Should this be an issue, +the method _save_installed_checksums can be invoked in a situation +where one is sure all modules on disk are installed and up-to-date in the +database.

+

To invoke the upgrade mechanism, navigate to Apps menu and use the +Auto-Upgrade Modules button, available only in developer mode. Restarting +the Odoo instance is highly recommended to minify risk of any possible issues.

+

Another easy way to invoke this upgrade mechanism is by issuing the following +in an Odoo shell session:

+
+env['ir.module.module'].upgrade_changed_checksum()
+
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • LasLabs
  • +
  • Juan José Scarafía
  • +
  • Tecnativa
  • +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/server-tools project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/module_auto_update/tests/__init__.py b/module_auto_update/tests/__init__.py new file mode 100644 index 000000000..98ee93c7e --- /dev/null +++ b/module_auto_update/tests/__init__.py @@ -0,0 +1,4 @@ +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from . import test_addon_hash +from . import test_module diff --git a/module_auto_update/tests/sample_module/README.rst b/module_auto_update/tests/sample_module/README.rst new file mode 100644 index 000000000..e7d1726ca --- /dev/null +++ b/module_auto_update/tests/sample_module/README.rst @@ -0,0 +1 @@ +Sample module for tests addon_hash module. diff --git a/module_auto_update/tests/sample_module/data/f1.xml b/module_auto_update/tests/sample_module/data/f1.xml new file mode 100644 index 000000000..238507479 --- /dev/null +++ b/module_auto_update/tests/sample_module/data/f1.xml @@ -0,0 +1 @@ + diff --git a/module_auto_update/tests/sample_module/data/f2.xml b/module_auto_update/tests/sample_module/data/f2.xml new file mode 100644 index 000000000..238507479 --- /dev/null +++ b/module_auto_update/tests/sample_module/data/f2.xml @@ -0,0 +1 @@ + diff --git a/module_auto_update/tests/sample_module/i18n/en.po b/module_auto_update/tests/sample_module/i18n/en.po new file mode 100644 index 000000000..e69de29bb diff --git a/module_auto_update/tests/sample_module/i18n/en_US.po b/module_auto_update/tests/sample_module/i18n/en_US.po new file mode 100644 index 000000000..e69de29bb diff --git a/module_auto_update/tests/sample_module/i18n/fr.po b/module_auto_update/tests/sample_module/i18n/fr.po new file mode 100644 index 000000000..e69de29bb diff --git a/module_auto_update/tests/sample_module/i18n/fr_BE.po b/module_auto_update/tests/sample_module/i18n/fr_BE.po new file mode 100644 index 000000000..e69de29bb diff --git a/module_auto_update/tests/sample_module/i18n/test.pot b/module_auto_update/tests/sample_module/i18n/test.pot new file mode 100644 index 000000000..e69de29bb diff --git a/module_auto_update/tests/sample_module/i18n_extra/en.po b/module_auto_update/tests/sample_module/i18n_extra/en.po new file mode 100644 index 000000000..e69de29bb diff --git a/module_auto_update/tests/sample_module/i18n_extra/fr.po b/module_auto_update/tests/sample_module/i18n_extra/fr.po new file mode 100644 index 000000000..e69de29bb diff --git a/module_auto_update/tests/sample_module/i18n_extra/nl_NL.po b/module_auto_update/tests/sample_module/i18n_extra/nl_NL.po new file mode 100644 index 000000000..e69de29bb diff --git a/module_auto_update/tests/sample_module/models/stuff.py b/module_auto_update/tests/sample_module/models/stuff.py new file mode 100644 index 000000000..911c43ed1 --- /dev/null +++ b/module_auto_update/tests/sample_module/models/stuff.py @@ -0,0 +1 @@ +_ = 1 + 1 diff --git a/module_auto_update/tests/sample_module/models/stuff.pyc b/module_auto_update/tests/sample_module/models/stuff.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2050f52c7c2e2c08bfb655555c80e4342a48a0c2 GIT binary patch literal 109 zcmZSn%**Avesxqb0~9a;X$K%K<^U2YObm=Ej10jV%s@^iBaraR1S!w}Vsrwmp}3?p ZElsbWvIL~tCO1E&G$+*#q^}sH0{{jG4&DF& literal 0 HcmV?d00001 diff --git a/module_auto_update/tests/sample_module/models/stuff.pyo b/module_auto_update/tests/sample_module/models/stuff.pyo new file mode 100644 index 0000000000000000000000000000000000000000..b592f19841e2fdfc90a584eb75703c9eed4782f2 GIT binary patch literal 109 zcmZSn%*$2zb3;@z0~9a;X$K%K<^U2YObm=Ej10jV%s@^iBaraR1S!w}Vsrwmp}3?p ZElsbWvIL~tCO1E&G$+*#q^}sH0{}a24`BcR literal 0 HcmV?d00001 diff --git a/module_auto_update/tests/sample_module/static/src/some.js b/module_auto_update/tests/sample_module/static/src/some.js new file mode 100644 index 000000000..896fe66fe --- /dev/null +++ b/module_auto_update/tests/sample_module/static/src/some.js @@ -0,0 +1 @@ +/* Javascript */ diff --git a/module_auto_update/tests/test_addon_hash.py b/module_auto_update/tests/test_addon_hash.py new file mode 100644 index 000000000..8c35f831a --- /dev/null +++ b/module_auto_update/tests/test_addon_hash.py @@ -0,0 +1,76 @@ +# Copyright 2018 ACSONE SA/NV. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +import os +import unittest + +from .. import addon_hash +from ..models.module import DEFAULT_EXCLUDE_PATTERNS + + +class TestAddonHash(unittest.TestCase): + def setUp(self): + super(TestAddonHash, self).setUp() + self.sample_dir = os.path.join( + os.path.dirname(__file__), + "sample_module", + ) + + def test_basic(self): + files = list( + addon_hash._walk( + self.sample_dir, + exclude_patterns=["*/__pycache__/*"], + keep_langs=[], + ) + ) + self.assertEqual( + files, + [ + "README.rst", + "data/f1.xml", + "data/f2.xml", + "i18n/en.po", + "i18n/en_US.po", + "i18n/fr.po", + "i18n/fr_BE.po", + "i18n/test.pot", + "i18n_extra/en.po", + "i18n_extra/fr.po", + "i18n_extra/nl_NL.po", + "models/stuff.py", + "models/stuff.pyc", + "models/stuff.pyo", + "static/src/some.js", + ], + ) + + def test_exclude(self): + files = list( + addon_hash._walk( + self.sample_dir, + exclude_patterns=DEFAULT_EXCLUDE_PATTERNS.split(","), + keep_langs=["fr_FR", "nl"], + ) + ) + self.assertEqual( + files, + [ + "README.rst", + "data/f1.xml", + "data/f2.xml", + "i18n/fr.po", + "i18n/fr_BE.po", + "i18n_extra/fr.po", + "i18n_extra/nl_NL.po", + "models/stuff.py", + ], + ) + + def test2(self): + checksum = addon_hash.addon_hash( + self.sample_dir, + exclude_patterns=["*.pyc", "*.pyo", "*.pot", "static/*"], + keep_langs=["fr_FR", "nl"], + ) + self.assertEqual(checksum, "fecb89486c8a29d1f760cbd01c1950f6e8421b14") diff --git a/module_auto_update/tests/test_module.py b/module_auto_update/tests/test_module.py new file mode 100644 index 000000000..f05b26164 --- /dev/null +++ b/module_auto_update/tests/test_module.py @@ -0,0 +1,233 @@ +# Copyright 2017 LasLabs Inc. +# Copyright 2018 ACSONE SA/NV. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +import os +import tempfile + +import mock + +import odoo +from odoo.modules import get_module_path +from odoo.tests import TransactionCase + +from ..addon_hash import addon_hash +from ..models.module import DEFAULT_EXCLUDE_PATTERNS, IncompleteUpgradeError + +MODULE_NAME = "module_auto_update" + + +class TestModule(TransactionCase): + def setUp(self): + super(TestModule, self).setUp() + self.own_module = self.env["ir.module.module"].search( + [("name", "=", MODULE_NAME)] + ) + self.own_dir_path = get_module_path(MODULE_NAME) + keep_langs = self.env["res.lang"].search([]).mapped("code") + self.own_checksum = addon_hash( + self.own_dir_path, + exclude_patterns=DEFAULT_EXCLUDE_PATTERNS.split(","), + keep_langs=keep_langs, + ) + self.own_writeable = os.access(self.own_dir_path, os.W_OK) + + def test_compute_checksum_dir(self): + """It should compute the directory's SHA-1 hash""" + self.assertEqual( + self.own_module._get_checksum_dir(), + self.own_checksum, + "Module directory checksum not computed properly", + ) + + def test_compute_checksum_dir_ignore_excluded(self): + """It should exclude .pyc/.pyo extensions from checksum + calculations""" + if not self.own_writeable: + self.skipTest("Own directory not writeable") + with tempfile.NamedTemporaryFile(suffix=".pyc", dir=self.own_dir_path): + self.assertEqual( + self.own_module._get_checksum_dir(), + self.own_checksum, + "SHA1 checksum does not ignore excluded extensions", + ) + + def test_compute_checksum_dir_recomputes_when_file_added(self): + """It should return a different value when a non-.pyc/.pyo file is + added to the module directory""" + if not self.own_writeable: + self.skipTest("Own directory not writeable") + with tempfile.NamedTemporaryFile(suffix=".py", dir=self.own_dir_path): + self.assertNotEqual( + self.own_module._get_checksum_dir(), + self.own_checksum, + "SHA1 checksum not recomputed", + ) + + def test_saved_checksums(self): + Imm = self.env["ir.module.module"] + base_module = Imm.search([("name", "=", "base")]) + self.assertEqual(base_module.state, "installed") + self.assertFalse(Imm._get_saved_checksums()) + Imm._save_installed_checksums() + saved_checksums = Imm._get_saved_checksums() + self.assertTrue(saved_checksums) + self.assertTrue(saved_checksums["base"]) + + def test_get_modules_with_changed_checksum(self): + Imm = self.env["ir.module.module"] + self.assertTrue(Imm._get_modules_with_changed_checksum()) + Imm._save_installed_checksums() + self.assertFalse(Imm._get_modules_with_changed_checksum()) + + +@odoo.tests.tagged("post_install", "-at_install") +class TestModuleAfterInstall(TransactionCase): + def setUp(self): + super(TestModuleAfterInstall, self).setUp() + Imm = self.env["ir.module.module"] + self.own_module = Imm.search([("name", "=", MODULE_NAME)]) + self.base_module = Imm.search([("name", "=", "base")]) + + def test_get_modules_partially_installed(self): + Imm = self.env["ir.module.module"] + self.assertTrue(self.own_module not in Imm._get_modules_partially_installed()) + self.own_module.button_upgrade() + self.assertTrue(self.own_module in Imm._get_modules_partially_installed()) + self.own_module.button_upgrade_cancel() + self.assertTrue(self.own_module not in Imm._get_modules_partially_installed()) + + def test_upgrade_changed_checksum(self): + Imm = self.env["ir.module.module"] + Bmu = self.env["base.module.upgrade"] + + # check modules are in installed state + installed_modules = Imm.search([("state", "=", "installed")]) + self.assertTrue(self.own_module in installed_modules) + self.assertTrue(self.base_module in installed_modules) + self.assertTrue(len(installed_modules) > 2) + # change the checksum of 'base' + Imm._save_installed_checksums() + saved_checksums = Imm._get_saved_checksums() + saved_checksums["base"] = False + Imm._save_checksums(saved_checksums) + changed_modules = Imm._get_modules_with_changed_checksum() + self.assertEqual(len(changed_modules), 1) + self.assertTrue(self.base_module in changed_modules) + + def upgrade_module_mock(self_model): + upgrade_module_mock.call_count += 1 + # since we are upgrading base, all installed module + # must have been marked to upgrade at this stage + self.assertEqual(self.base_module.state, "to upgrade") + self.assertEqual(self.own_module.state, "to upgrade") + installed_modules.write({"state": "installed"}) + + upgrade_module_mock.call_count = 0 + + # upgrade_changed_checksum commits, so mock that + with mock.patch.object(self.env.cr, "commit"): + + # we simulate an install by setting module states + Bmu._patch_method("upgrade_module", upgrade_module_mock) + try: + Imm.upgrade_changed_checksum() + self.assertEqual(upgrade_module_mock.call_count, 1) + self.assertEqual(self.base_module.state, "installed") + self.assertEqual(self.own_module.state, "installed") + saved_checksums = Imm._get_saved_checksums() + self.assertTrue(saved_checksums["base"]) + self.assertTrue(saved_checksums[MODULE_NAME]) + finally: + Bmu._revert_method("upgrade_module") + + def test_incomplete_upgrade(self): + Imm = self.env["ir.module.module"] + Bmu = self.env["base.module.upgrade"] + + installed_modules = Imm.search([("state", "=", "installed")]) + # change the checksum of 'base' + Imm._save_installed_checksums() + saved_checksums = Imm._get_saved_checksums() + saved_checksums["base"] = False + Imm._save_checksums(saved_checksums) + + def upgrade_module_mock(self_model): + upgrade_module_mock.call_count += 1 + # since we are upgrading base, all installed module + # must have been marked to upgrade at this stage + self.assertEqual(self.base_module.state, "to upgrade") + self.assertEqual(self.own_module.state, "to upgrade") + installed_modules.write({"state": "installed"}) + # simulate partial upgrade + self.own_module.write({"state": "to upgrade"}) + + upgrade_module_mock.call_count = 0 + + # upgrade_changed_checksum commits, so mock that + with mock.patch.object(self.env.cr, "commit"): + + # we simulate an install by setting module states + Bmu._patch_method("upgrade_module", upgrade_module_mock) + try: + with self.assertRaises(IncompleteUpgradeError): + Imm.upgrade_changed_checksum() + self.assertEqual(upgrade_module_mock.call_count, 1) + finally: + Bmu._revert_method("upgrade_module") + + def test_incomplete_upgrade_no_checkusm(self): + Imm = self.env["ir.module.module"] + Bmu = self.env["base.module.upgrade"] + + installed_modules = Imm.search([("state", "=", "installed")]) + # change the checksum of 'base' + Imm._save_installed_checksums() + saved_checksums = Imm._get_saved_checksums() + + Imm._save_checksums(saved_checksums) + self.base_module.write({"state": "to upgrade"}) + + def upgrade_module_mock(self_model): + upgrade_module_mock.call_count += 1 + # since we are upgrading base, all installed module + # must have been marked to upgrade at this stage + self.assertEqual(self.base_module.state, "to upgrade") + self.assertEqual(self.own_module.state, "installed") + installed_modules.write({"state": "installed"}) + + upgrade_module_mock.call_count = 0 + + # upgrade_changed_checksum commits, so mock that + with mock.patch.object(self.env.cr, "commit"): + + # we simulate an install by setting module states + Bmu._patch_method("upgrade_module", upgrade_module_mock) + # got just other modules to_upgrade and no checksum ones + try: + Imm.upgrade_changed_checksum() + self.assertEqual(upgrade_module_mock.call_count, 1) + finally: + Bmu._revert_method("upgrade_module") + + def test_nothing_to_upgrade(self): + Imm = self.env["ir.module.module"] + Bmu = self.env["base.module.upgrade"] + + Imm._save_installed_checksums() + + def upgrade_module_mock(self_model): + upgrade_module_mock.call_count += 1 + + upgrade_module_mock.call_count = 0 + + # upgrade_changed_checksum commits, so mock that + with mock.patch.object(self.env.cr, "commit"): + + # we simulate an install by setting module states + Bmu._patch_method("upgrade_module", upgrade_module_mock) + try: + Imm.upgrade_changed_checksum() + self.assertEqual(upgrade_module_mock.call_count, 0) + finally: + Bmu._revert_method("upgrade_module") diff --git a/module_auto_update/views/ir_module_module.xml b/module_auto_update/views/ir_module_module.xml new file mode 100644 index 000000000..05be0e927 --- /dev/null +++ b/module_auto_update/views/ir_module_module.xml @@ -0,0 +1,24 @@ + + + + + Auto-Upgrade Modules + ir.actions.server + + code + + action = model.upgrade_changed_checksum() + + + + From 92070c15c79222ea022435079f1ac5a5225b765b Mon Sep 17 00:00:00 2001 From: Ignacio Buioli Date: Sun, 4 Sep 2022 03:51:13 +0000 Subject: [PATCH 2/6] Added translation using Weblate (Spanish (Argentina)) --- module_auto_update/i18n/es_AR.po | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 module_auto_update/i18n/es_AR.po diff --git a/module_auto_update/i18n/es_AR.po b/module_auto_update/i18n/es_AR.po new file mode 100644 index 000000000..b6c8e3f96 --- /dev/null +++ b/module_auto_update/i18n/es_AR.po @@ -0,0 +1,40 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * module_auto_update +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: es_AR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: module_auto_update +#: model:ir.actions.server,name:module_auto_update.ir_module_module_upgrade_changed_checksum +#: model:ir.ui.menu,name:module_auto_update.menu_ir_module_module_upgrade_changed_checksum +msgid "Auto-Upgrade Modules" +msgstr "" + +#. module: module_auto_update +#: code:addons/module_auto_update/models/module.py:0 +#, python-format +msgid "Checksum upgrade complete." +msgstr "" + +#. module: module_auto_update +#: model:ir.model,name:module_auto_update.model_ir_module_module +msgid "Module" +msgstr "" + +#. module: module_auto_update +#: code:addons/module_auto_update/models/module.py:0 +#, python-format +msgid "" +"No checksum change detected in installed modules and all modules installed, " +"nothing to do." +msgstr "" From 8da52e804bc4fa25b47117fc0ed56c24ecc25d98 Mon Sep 17 00:00:00 2001 From: Ignacio Buioli Date: Sun, 4 Sep 2022 03:54:22 +0000 Subject: [PATCH 3/6] Translated using Weblate (Spanish (Argentina)) Currently translated at 100.0% (4 of 4 strings) Translation: server-tools-15.0/server-tools-15.0-module_auto_update Translate-URL: https://translation.odoo-community.org/projects/server-tools-15-0/server-tools-15-0-module_auto_update/es_AR/ --- module_auto_update/i18n/es_AR.po | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/module_auto_update/i18n/es_AR.po b/module_auto_update/i18n/es_AR.po index b6c8e3f96..7023c2f6d 100644 --- a/module_auto_update/i18n/es_AR.po +++ b/module_auto_update/i18n/es_AR.po @@ -6,30 +6,32 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2022-09-04 06:07+0000\n" +"Last-Translator: Ignacio Buioli \n" "Language-Team: none\n" "Language: es_AR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" #. module: module_auto_update #: model:ir.actions.server,name:module_auto_update.ir_module_module_upgrade_changed_checksum #: model:ir.ui.menu,name:module_auto_update.menu_ir_module_module_upgrade_changed_checksum msgid "Auto-Upgrade Modules" -msgstr "" +msgstr "Módulos Auto-Actualizables" #. module: module_auto_update #: code:addons/module_auto_update/models/module.py:0 #, python-format msgid "Checksum upgrade complete." -msgstr "" +msgstr "Actualización de suma de comprobación completa." #. module: module_auto_update #: model:ir.model,name:module_auto_update.model_ir_module_module msgid "Module" -msgstr "" +msgstr "Módulo" #. module: module_auto_update #: code:addons/module_auto_update/models/module.py:0 @@ -38,3 +40,5 @@ msgid "" "No checksum change detected in installed modules and all modules installed, " "nothing to do." msgstr "" +"No se detectó ningún cambio de suma de comprobación en los módulos " +"instalados y todos los módulos instalados, nada que hacer." From 6c8b6be5cfc87baf9f7b56af03719c8626e0b405 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Sun, 15 Jan 2023 15:19:13 +0100 Subject: [PATCH 4/6] dotfiles --- module_auto_update/tests/sample_module/i18n/en.po | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 module_auto_update/tests/sample_module/i18n/en.po diff --git a/module_auto_update/tests/sample_module/i18n/en.po b/module_auto_update/tests/sample_module/i18n/en.po deleted file mode 100644 index e69de29bb..000000000 From 5431471238084d44b74fe9221d495b8481e9beac Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Sun, 15 Jan 2023 16:52:14 +0000 Subject: [PATCH 5/6] module_auto_update 15.0.1.0.1 --- module_auto_update/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module_auto_update/__manifest__.py b/module_auto_update/__manifest__.py index 37b2f7915..a618d32c8 100644 --- a/module_auto_update/__manifest__.py +++ b/module_auto_update/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Module Auto Update", "summary": "Automatically update Odoo modules", - "version": "15.0.1.0.0", + "version": "15.0.1.0.1", "category": "Extra Tools", "website": "https://github.com/OCA/server-tools", "author": "LasLabs, " From f555e90ab390177d12bbedc6c570bf285c9e4950 Mon Sep 17 00:00:00 2001 From: fkantelberg Date: Tue, 7 Feb 2023 14:46:54 +0100 Subject: [PATCH 6/6] [MIG] module_auto_update: Migration to 16.0 --- module_auto_update/__manifest__.py | 2 +- module_auto_update/models/module.py | 2 +- module_auto_update/tests/test_module.py | 3 +-- setup/module_auto_update/odoo/addons/module_auto_update | 1 + setup/module_auto_update/setup.py | 6 ++++++ 5 files changed, 10 insertions(+), 4 deletions(-) create mode 120000 setup/module_auto_update/odoo/addons/module_auto_update create mode 100644 setup/module_auto_update/setup.py diff --git a/module_auto_update/__manifest__.py b/module_auto_update/__manifest__.py index a618d32c8..caf030b59 100644 --- a/module_auto_update/__manifest__.py +++ b/module_auto_update/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Module Auto Update", "summary": "Automatically update Odoo modules", - "version": "15.0.1.0.1", + "version": "16.0.1.0.0", "category": "Extra Tools", "website": "https://github.com/OCA/server-tools", "author": "LasLabs, " diff --git a/module_auto_update/models/module.py b/module_auto_update/models/module.py index b50bf1ccd..4ecc19bcb 100644 --- a/module_auto_update/models/module.py +++ b/module_auto_update/models/module.py @@ -80,7 +80,7 @@ class Module(models.Model): def _save_checksums(self, checksums): Icp = self.env["ir.config_parameter"] Icp.set_param(PARAM_INSTALLED_CHECKSUMS, json.dumps(checksums)) - Icp.flush() + Icp.flush_model() @api.model def _save_installed_checksums(self): diff --git a/module_auto_update/tests/test_module.py b/module_auto_update/tests/test_module.py index f05b26164..0b74ed775 100644 --- a/module_auto_update/tests/test_module.py +++ b/module_auto_update/tests/test_module.py @@ -4,8 +4,7 @@ import os import tempfile - -import mock +from unittest import mock import odoo from odoo.modules import get_module_path diff --git a/setup/module_auto_update/odoo/addons/module_auto_update b/setup/module_auto_update/odoo/addons/module_auto_update new file mode 120000 index 000000000..752ff6fc9 --- /dev/null +++ b/setup/module_auto_update/odoo/addons/module_auto_update @@ -0,0 +1 @@ +../../../../module_auto_update \ No newline at end of file diff --git a/setup/module_auto_update/setup.py b/setup/module_auto_update/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/module_auto_update/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)