Skip to content

Instantly share code, notes, and snippets.

@grindtildeath
Last active August 18, 2022 14:21
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save grindtildeath/91f14abf85bda9dd61f8c2974f6aca02 to your computer and use it in GitHub Desktop.
Save grindtildeath/91f14abf85bda9dd61f8c2974f6aca02 to your computer and use it in GitHub Desktop.
Odoo module dependency graph
WITH recursive dep_tree AS (
SELECT mdl0.id, mdl0.name, NULL::integer, 1 AS level, array[mdl0.id] AS path_info
FROM ir_module_module mdl0
WHERE name = 'sale' -- state here the child module
UNION ALL
SELECT (SELECT mdl1.id FROM ir_module_module mdl1 WHERE mdl1.name = c.name), rpad('', p.level * 1, '_') || c.name, c.module_id, p.level + 1, p.path_info||c.id
FROM ir_module_module_dependency c
JOIN dep_tree p ON c.module_id = p.id
WHERE level < 5 -- define here the levels to be displayed
)
SELECT level, name
FROM dep_tree
ORDER BY path_info;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment