Skip to content

Commit

Permalink
Merge PR OCA#2811 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by legalsylvain
  • Loading branch information
OCA-git-bot committed May 28, 2024
2 parents 2d2c192 + 1fa1277 commit 7bd2ba5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
11 changes: 9 additions & 2 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 @@ -52,10 +53,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
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

0 comments on commit 7bd2ba5

Please sign in to comment.