Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
57e5219
README.rst
OCA-git-bot Jul 15, 2022
1760b92
Added translation using Weblate (Spanish (Argentina))
ibuioli Sep 4, 2022
827af1e
Translated using Weblate (Spanish (Argentina))
ibuioli Sep 4, 2022
7f09f89
dotfiles
StefanRijnhart Jan 15, 2023
08f0a0f
module_auto_update 15.0.1.0.1
OCA-git-bot Jan 15, 2023
4aaea12
module_auto_update: Migration to 16.0
fkantelberg Feb 7, 2023
57bae1f
Update module_auto_update.pot
Apr 13, 2023
b213ec5
README.rst
OCA-git-bot Apr 13, 2023
f94ad06
Update translation files
weblate Apr 13, 2023
9de9082
Update module_auto_update.pot
Jun 7, 2023
df9b007
Update translation files
weblate Jun 7, 2023
e9a2c4e
Translated using Weblate (Spanish (Argentina))
ibuioli Jun 9, 2023
7286a78
Translated using Weblate (Spanish)
Ivorra78 Aug 27, 2023
cf2c051
README.rst
OCA-git-bot Sep 3, 2023
9a0ec28
Translated using Weblate (Italian)
mymage Sep 21, 2023
899ac70
module_auto_update: pre-commit auto fixes
fkantelberg Nov 24, 2023
5b6b58f
module_auto_update: Migration to 17.0
fkantelberg Nov 24, 2023
ad194a3
enable test that got disabled
Feb 14, 2024
df015dc
Update module_auto_update.pot
May 3, 2024
3afac6e
post-merge updates
OCA-git-bot May 3, 2024
f1e7510
Update translation files
weblate May 3, 2024
8ab1a99
Translated using Weblate (Italian)
mymage May 3, 2024
9a2b3f3
Translated using Weblate (Chinese (Simplified) (zh_CN))
xtanuiha Jun 16, 2024
1863afa
module_auto_update: Migration to 18.0
fkantelberg Feb 4, 2025
dae8f13
Update module_auto_update.pot
Feb 20, 2025
f545c71
post-merge updates
OCA-git-bot Feb 20, 2025
2afcea9
Update module_auto_update.pot
Mar 16, 2025
ee517f7
Update translation files
weblate Mar 16, 2025
28bb9b9
[19.0][MIG] module_auto_update: Migration to 19.0
fkantelberg Dec 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions module_auto_update/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==================
Module Auto Update
==================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b346c35002421982ddef8e3463e21ac3982e69ce94502b48ab0c36081e2e0ed5
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/license-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/19.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-19-0/server-tools-19-0-module_auto_update
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=19.0
:alt: Try me on Runboat

|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.

As an alternative to this module
`click-odoo-update <https://github.com/acsone/click-odoo-contrib>`__ can
also be integrated in your non-Odoo maintenance tools instead.

**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/*,tests/*``. 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:: python

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

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20module_auto_update%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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 <brent.hughes@laslabs.com>
- Juan José Scarafía <jjs@adhoc.com.ar>
- Jairo Llopis <jairo.llopis@tecnativa.com>
- Stéphane Bidoul <stephane.bidoul@acsone.eu> (https://acsone.eu)
- Eric Antones <eantones@nuobit.com>
- Manuel Engel <manuel.engel@initos.com>

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 <https://github.com/OCA/server-tools/tree/19.0/module_auto_update>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions module_auto_update/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).

from . import models
from .hooks import uninstall_hook
22 changes: 22 additions & 0 deletions module_auto_update/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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": "19.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",
}
44 changes: 44 additions & 0 deletions module_auto_update/addon_hash.py
Original file line number Diff line number Diff line change
@@ -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()
8 changes: 8 additions & 0 deletions module_auto_update/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).

from .models.module import PARAM_INSTALLED_CHECKSUMS


def uninstall_hook(env):
env["ir.config_parameter"].set_param(PARAM_INSTALLED_CHECKSUMS, False)
49 changes: 49 additions & 0 deletions module_auto_update/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * module_auto_update
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 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 <transbot@odoo-community.org>, 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
#. odoo-python
#: code:addons/module_auto_update/models/module.py:0
msgid "Checksum upgrade complete."
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
#. odoo-python
#: code:addons/module_auto_update/models/module.py:0
msgid ""
"No checksum change detected in installed modules and all modules installed, "
"nothing to do."
msgstr ""

#. module: module_auto_update
#: model:ir.model.fields,field_description:module_auto_update.field_ir_module_module__smart_search
msgid "Smart Search"
msgstr ""
74 changes: 74 additions & 0 deletions module_auto_update/i18n/cs_CZ.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * module_auto_update
#
# Translators:
# Lukáš Spurný <lukasspurny8@gmail.com>, 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ý <lukasspurny8@gmail.com>, 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
#. odoo-python
#: code:addons/module_auto_update/models/module.py:0
msgid "Checksum upgrade complete."
msgstr ""

#. module: module_auto_update
#: model:ir.model,name:module_auto_update.model_ir_module_module
msgid "Module"
msgstr "Modul"

#. module: module_auto_update
#. odoo-python
#: code:addons/module_auto_update/models/module.py:0
msgid ""
"No checksum change detected in installed modules and all modules installed, "
"nothing to do."
msgstr ""

#. 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"
Loading