Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] util/modules: fix discovery of no-deps modules #186

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
20 changes: 11 additions & 9 deletions src/util/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,9 @@ def force_install_module(cr, module, if_installed=None, reason="it has been expl
cr.execute(
"""
WITH RECURSIVE deps (mod_id, dep_name) AS (
SELECT m.id, d.name from ir_module_module_dependency d
JOIN ir_module_module m on (d.module_id = m.id)
WHERE m.name = %s
SELECT m.id, m.name
FROM ir_module_module m
WHERE m.name = %s
UNION
SELECT m.id, d.name from ir_module_module m
JOIN deps ON deps.dep_name = m.name
Expand All @@ -543,7 +543,7 @@ def force_install_module(cr, module, if_installed=None, reason="it has been expl
demo=(select demo from ir_module_module where name='base')
FROM deps d
WHERE m.id = d.mod_id
{0}
{}
RETURNING m.name, m.state
""".format(subquery),
(module,) + subparams,
Expand Down Expand Up @@ -721,7 +721,7 @@ def trigger_auto_install(cr, module):

dep_match = "true"
if column_exists(cr, "ir_module_module_dependency", "auto_install_required"):
dep_match = "d.auto_install_required = true"
dep_match = "COALESCE(d.auto_install_required, true) = true"

country_match = country_join = ""
if table_exists(cr, "module_country"):
Expand Down Expand Up @@ -753,17 +753,19 @@ def trigger_auto_install(cr, module):

query = """
SELECT m.id
FROM ir_module_module_dependency d
JOIN ir_module_module m ON m.id = d.module_id
JOIN ir_module_module md ON md.name = d.name
FROM ir_module_module m
LEFT JOIN ir_module_module_dependency d
ON m.id = d.module_id
LEFT JOIN ir_module_module md
ON md.name = d.name
{}
WHERE m.name = %s
AND m.state = 'uninstalled'
AND m.auto_install = true
AND {}
AND {}
GROUP BY m.id
HAVING bool_and(md.state IN %s)
HAVING (bool_and(md.state IN %s) OR count(d.id) = 0)
{}
""".format(country_join, dep_match, cat_match, country_match)

Expand Down