Skip to content

Instantly share code, notes, and snippets.

@emilkholod
emilkholod / odoo_module_dependency_graph.sql
Last active September 20, 2023 11:19 — forked from grindtildeath/odoo_module_dependency_graph.sql
Odoo module dependency/inheritance 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 < 10 -- define here the levels to be displayed
AND c.name not in ('base','web', 'base_setup', 'web_tour', 'mail', 'uom', 'portal', 'digest')