From 6a6077b3136f4d0a931c85303b71a03e1c819e65 Mon Sep 17 00:00:00 2001 From: Julien Castiaux Date: Mon, 23 Nov 2020 11:42:58 +0000 Subject: [PATCH] [FIX] module.py: Remove leftover "active" from manifest The "active" field is a non-working deprecated alias to "auto_install", it does not work and was confusing users (see #59850). It has been removed. closes odoo/odoo#62086 Task: 2361729 Signed-off-by: Julien Castiaux --- addons/account_test/__manifest__.py | 1 - addons/l10n_fi/__manifest__.py | 1 - addons/l10n_hr/__manifest__.py | 1 - addons/l10n_no/__manifest__.py | 1 - doc/reference/module.rst | 2 -- odoo/modules/module.py | 19 +++++++++---------- 6 files changed, 9 insertions(+), 16 deletions(-) diff --git a/addons/account_test/__manifest__.py b/addons/account_test/__manifest__.py index c361378e6a2..99767304d7b 100644 --- a/addons/account_test/__manifest__.py +++ b/addons/account_test/__manifest__.py @@ -25,6 +25,5 @@ and print the report from Print button in header area. 'data/accounting_assert_test_data.xml', 'report/report_account_test_templates.xml', ], - 'active': False, 'installable': True } diff --git a/addons/l10n_fi/__manifest__.py b/addons/l10n_fi/__manifest__.py index 19e9dbe98c5..94160c91bae 100644 --- a/addons/l10n_fi/__manifest__.py +++ b/addons/l10n_fi/__manifest__.py @@ -39,6 +39,5 @@ Set the payment reference type from the Sales Journal. "demo": [ 'demo/demo_company.xml', ], - "active": True, "installable": True, } diff --git a/addons/l10n_hr/__manifest__.py b/addons/l10n_hr/__manifest__.py index 56a7453fa1f..200ed60e369 100644 --- a/addons/l10n_hr/__manifest__.py +++ b/addons/l10n_hr/__manifest__.py @@ -59,5 +59,4 @@ Izvori podataka: 'demo': [ 'demo/demo_company.xml', ], - "active": False, } diff --git a/addons/l10n_no/__manifest__.py b/addons/l10n_no/__manifest__.py index b159c7fb981..ca1c4cf880f 100644 --- a/addons/l10n_no/__manifest__.py +++ b/addons/l10n_no/__manifest__.py @@ -25,6 +25,5 @@ Updated for Odoo 9 by Bringsvor Consulting AS 'demo': [ 'demo/demo_company.xml', ], - "active": False, 'post_init_hook': '_preserve_tag_on_taxes', } diff --git a/doc/reference/module.rst b/doc/reference/module.rst index 2c91e4f6d6e..dc3088b512d 100644 --- a/doc/reference/module.rst +++ b/doc/reference/module.rst @@ -140,8 +140,6 @@ Available manifest fields are: These hooks should only be used when setup/cleanup required for this module is either extremely difficult or impossible through the api. -``active`` (``bool``) - This indicates whether this module must install automatically or not. .. _semantic versioning: https://semver.org .. _existing categories: diff --git a/odoo/modules/module.py b/odoo/modules/module.py index 992fcf7b073..5631f506c62 100644 --- a/odoo/modules/module.py +++ b/odoo/modules/module.py @@ -320,23 +320,22 @@ def load_information_from_description_file(module, mod_path=None): with tools.file_open(readme_path[0]) as fd: info['description'] = fd.read() - # auto_install is set to `False` if disabled, and a set of - # auto_install dependencies otherwise. That way, we can set - # auto_install: [] to always auto_install a module regardless of its - # dependencies - auto_install = info.get('auto_install', info.get('active', False)) - if isinstance(auto_install, collections.abc.Iterable): - info['auto_install'] = set(auto_install) + + # auto_install is either `False` (by default) in which case the module + # is opt-in, either a list of dependencies in which case the module is + # automatically installed if all dependencies are (special case: [] to + # always install the module), either `True` to auto-install the module + # in case all dependencies declared in `depends` are installed. + if isinstance(info['auto_install'], collections.abc.Iterable): + info['auto_install'] = set(info['auto_install']) non_dependencies = info['auto_install'].difference(info['depends']) assert not non_dependencies,\ "auto_install triggers must be dependencies, found " \ "non-dependencies [%s] for module %s" % ( ', '.join(non_dependencies), module ) - elif auto_install: + elif info['auto_install']: info['auto_install'] = set(info['depends']) - else: - info['auto_install'] = False info['version'] = adapt_version(info['version']) return info