Skip to content

[IMP] addons info in models graph#11

Open
dz0 wants to merge 1 commit into
initOS:masterfrom
dz0:patch-1
Open

[IMP] addons info in models graph#11
dz0 wants to merge 1 commit into
initOS:masterfrom
dz0:patch-1

Conversation

@dz0
Copy link
Copy Markdown

@dz0 dz0 commented Apr 21, 2026

to see better picture: where the model is extended

to see better picture: where the model is extended
Copy link
Copy Markdown
Member

@fkantelberg fkantelberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally got some time to look over it. I understand the idea but I'm currently not sure if this is how we should implement it as this would make the output unusable for something like often used models.

Comment thread src/odoo_analyse/odoo.py
if addons:
extended_name = (f"{model_name} \\n\\n*addons*\\n"
f" {',\\n'.join(addons)}")
name_mapping[model_name] = extended_name
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will just clutter the output especially if you have models like res.partner which are all over the place. I'm not sure if the MRO from this tool is reliable enough outside of the Odoo shell if you want to know which function is behind the next super() and if you have an Odoo shell there are better options to analyze an Odoo environment and the dependencies. Knowing which module extends a model is quite important though but I'm not sure if this format is great here.

Do you have a better suggestion? If not this shouldn't be the default behaviour and only available with a flag/option set.

Comment thread src/odoo_analyse/odoo.py

self._show_graph(
graph, check_node, color_node, color_edge, filename=filename or "model.gv"
graph, check_node, color_node, color_edge, filename=filename or "model.gv.dot"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't have to be dot because you can change the engine with an option.

Comment thread src/odoo_analyse/odoo.py
for model_name, deps in graph.items():
extended_name = name_mapping.get(model_name, model_name)
extended_deps = {name_mapping.get(x, x) for x in deps}
extended_graph[extended_name] = extended_deps
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather implement a labels argument in _show_graph than using these extended names here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants