Skip to content

Commit

Permalink
[UPD] module_change_auto_install from upstream (OCA/server-tools)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarteo committed Jan 22, 2025
1 parent 9ad3034 commit 1895744
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 64 deletions.
43 changes: 34 additions & 9 deletions module_change_auto_install/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
Change auto installable modules
===============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:803c0e63b0a4fd39047840304e38f292dc26531ff41d17fc433439c1034f8dd7
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
Expand All @@ -19,11 +22,11 @@ Change auto installable modules
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-module_change_auto_install
: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/16.0
:alt: Try me on Runbot
.. |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=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
|badge1| |badge2| |badge3| |badge4| |badge5|

In odoo, by default some modules are marked as auto installable
by the ``auto_install`` key present in the manifest.
Expand Down Expand Up @@ -52,7 +55,7 @@ Installation
You don't have to install this module. To make the features working :

* make the module ``module_change_auto_install`` available in your addons path
* update your ``odoo.cfg`` following the "Configure" section
* either update your ``odoo.cfg`` or set the environment variables following the "Configure" section

Configuration
=============
Expand All @@ -63,15 +66,20 @@ Configuration

* (optional) Add a new entry ``modules_auto_install_disabled`` to mark
a list of modules as NOT auto installable.
The environment variable ``ODOO_MODULES_AUTO_INSTALL_DISABLED`` can also be set.

* (optional) Add a new entry ``modules_auto_install_enabled`` to mark
a list of modules as auto installable. This feature can be usefull for companies
that are hosting a lot of Odoo instances for many customers, and want some modules
to be always installed.
The environment variable ``ODOO_MODULES_AUTO_INSTALL_ENABLED`` can also be set.

The values in the configuration file takes precedence over the environment variable
values.

**Typical Settings**

.. code-block:: shell
.. code-block:: cfg
server_wide_modules = web,module_change_auto_install
Expand All @@ -86,6 +94,13 @@ Configuration
disable_odoo_online,
account_usability
When using environment variables, the same configuration is:

.. code-block:: shell
export ODOO_MODULES_AUTO_INSTALL_DISABLED=partner_autocomplete,iap,mail_bot
export ODOO_MODULES_AUTO_INSTALL_ENABLED=web_responsive:web,base_technical_features,disable_odoo_online,account_usability
Run your instance and check logs. Modules that has been altered should be present in your log, at the load of your instance:

.. code-block:: shell
Expand All @@ -99,7 +114,7 @@ Run your instance and check logs. Modules that has been altered should be presen

if your ``odoo.cfg`` file contains the following configuration:

.. code-block:: shell
.. code-block:: cfg
modules_auto_install_enabled =
account_usability,
Expand All @@ -117,6 +132,13 @@ The behaviour will be the following:

* ``point_of_sale`` module will be installed as soon as ``sale`` and ``purchase`` module are installed.

When using environment variables, the same configuration is:

.. code-block:: shell
export ODOO_MODULES_AUTO_INSTALL_ENABLED=account_usability,web_responsive:web,base_technical_features:,point_of_sale:sale/purchase
Development
===========

Expand All @@ -130,7 +152,7 @@ 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 smashing it by providing a detailed and welcomed
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_change_auto_install%0Aversion:%2016.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.
Expand All @@ -147,6 +169,9 @@ Contributors
~~~~~~~~~~~~

* Sylvain LE GAL <https://twitter.com/legalsylvain>
* XCG Consulting, part of `Orbeet <https://orbeet.io/>`__:

* Vincent Hatakeyama <[email protected]>

Maintainers
~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion module_change_auto_install/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Change auto installable modules",
"summary": "Customize auto installables modules by configuration",
"version": "16.0.1.0.0",
"version": "16.0.1.0.2",
"category": "Tools",
"maintainers": ["legalsylvain"],
"author": "GRAP, Odoo Community Association (OCA)",
Expand Down
14 changes: 14 additions & 0 deletions module_change_auto_install/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\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"
13 changes: 10 additions & 3 deletions module_change_auto_install/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

import logging
import os

from odoo import modules
from odoo.tools import config
Expand Down Expand Up @@ -51,10 +52,16 @@ def _overload_load_manifest(module, mod_path=None):
auto_install = res.get("auto_install", False)

modules_auto_install_enabled_dict = _get_modules_dict_auto_install_config(
config.get("modules_auto_install_enabled")
config.get(
"modules_auto_install_enabled",
os.environ.get("ODOO_MODULES_AUTO_INSTALL_ENABLED"),
)
)
modules_auto_install_disabled_dict = _get_modules_dict_auto_install_config(
config.get("modules_auto_install_disabled")
config.get(
"modules_auto_install_disabled",
os.environ.get("ODOO_MODULES_AUTO_INSTALL_DISABLED"),
)
)

if auto_install and module in modules_auto_install_disabled_dict.keys():
Expand Down Expand Up @@ -85,6 +92,6 @@ def _overload_load_manifest(module, mod_path=None):


def post_load():
_logger.info("Aplying patch module_change_auto_intall ...")
_logger.info("Applying patch module_change_auto_intall ...")
modules.module.load_manifest = _overload_load_manifest
modules.load_manifest = _overload_load_manifest
23 changes: 21 additions & 2 deletions module_change_auto_install/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@

* (optional) Add a new entry ``modules_auto_install_disabled`` to mark
a list of modules as NOT auto installable.
The environment variable ``ODOO_MODULES_AUTO_INSTALL_DISABLED`` can also be set.

* (optional) Add a new entry ``modules_auto_install_enabled`` to mark
a list of modules as auto installable. This feature can be usefull for companies
that are hosting a lot of Odoo instances for many customers, and want some modules
to be always installed.
The environment variable ``ODOO_MODULES_AUTO_INSTALL_ENABLED`` can also be set.

The values in the configuration file takes precedence over the environment variable
values.

**Typical Settings**

.. code-block:: shell
.. code-block:: cfg
server_wide_modules = web,module_change_auto_install
Expand All @@ -27,6 +32,13 @@
disable_odoo_online,
account_usability
When using environment variables, the same configuration is:

.. code-block:: shell
export ODOO_MODULES_AUTO_INSTALL_DISABLED=partner_autocomplete,iap,mail_bot
export ODOO_MODULES_AUTO_INSTALL_ENABLED=web_responsive:web,base_technical_features,disable_odoo_online,account_usability
Run your instance and check logs. Modules that has been altered should be present in your log, at the load of your instance:

.. code-block:: shell
Expand All @@ -40,7 +52,7 @@ Run your instance and check logs. Modules that has been altered should be presen

if your ``odoo.cfg`` file contains the following configuration:

.. code-block:: shell
.. code-block:: cfg
modules_auto_install_enabled =
account_usability,
Expand All @@ -57,3 +69,10 @@ The behaviour will be the following:
* ``base_technical_features`` will be ALWAYS installed

* ``point_of_sale`` module will be installed as soon as ``sale`` and ``purchase`` module are installed.

When using environment variables, the same configuration is:

.. code-block:: shell
export ODOO_MODULES_AUTO_INSTALL_ENABLED=account_usability,web_responsive:web,base_technical_features:,point_of_sale:sale/purchase
3 changes: 3 additions & 0 deletions module_change_auto_install/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
* Sylvain LE GAL <https://twitter.com/legalsylvain>
* XCG Consulting, part of `Orbeet <https://orbeet.io/>`__:

* Vincent Hatakeyama <[email protected]>
2 changes: 1 addition & 1 deletion module_change_auto_install/readme/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
You don't have to install this module. To make the features working :

* make the module ``module_change_auto_install`` available in your addons path
* update your ``odoo.cfg`` following the "Configure" section
* either update your ``odoo.cfg`` or set the environment variables following the "Configure" section
Loading

0 comments on commit 1895744

Please sign in to comment.