Skip to content

Commit e71e5a5

Browse files
committed
[FIX] util.trigger_auto_install
Correctly set the auto_install modules as installed. Just changing the state is not enough. All its dependencies should be installed. As example, in version 16.0, the new `spreadsheet_dashboard_account` module is defined as ``` { 'depends': ['spreadsheet_dashboard', 'account'], 'auto_install': ['account'], } ``` So, when `account` is installed, this new module should be auto installed, but also its uninstalled dependencies. In this case, the module `spreadsheet_dashboard` should also be marked as installed, as well as its dependencies, recursively. Part of odoo/upgrade#5343 Signed-off-by: Christophe Simonis (chs) <[email protected]>
1 parent 8df49d3 commit e71e5a5

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/util/modules.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,6 @@ def trigger_auto_install(cr, module):
592592
cat_match = cr.mogrify("m.category_id = %s", [hidden]).decode()
593593

594594
query = """
595-
WITH to_install AS (
596595
SELECT m.id
597596
FROM ir_module_module_dependency d
598597
JOIN ir_module_module m ON m.id = d.module_id
@@ -604,17 +603,15 @@ def trigger_auto_install(cr, module):
604603
AND {}
605604
GROUP BY m.id
606605
HAVING bool_and(md.state IN %s)
607-
)
608-
UPDATE ir_module_module m
609-
SET state = 'to install'
610-
FROM to_install t
611-
WHERE t.id = m.id
612606
""".format(
613607
dep_match, cat_match
614608
)
615609

616610
cr.execute(query, [module, INSTALLED_MODULE_STATES])
617-
return bool(cr.rowcount)
611+
if cr.rowcount:
612+
force_install_module(cr, module)
613+
return True
614+
return False
618615

619616

620617
def _set_module_category(cr, module, category):

0 commit comments

Comments
 (0)