Skip to content

OD504 circular-dependency

A module in depends depends back on this module.

Category Severity Series Needs the index
Correctness Error all yes

What it reports

An entry of the manifest's depends from which the module itself can be reached again by following depends, directly or through other modules. Each checked module in the cycle is reported, on the dependency that leads back to it.

Why it matters

Odoo installs a module after the modules it depends on, and a cycle leaves no module to start with. Installing either one sends Odoo from each module to the other until it gives up with Recursion error in modules dependencies!, so neither can be installed. The cycle usually appears when two modules grow to need something from each other, and the second dependency is added to make one import or one view work.

Example

loyalty_card/__manifest__.py
{
    "name": "Loyalty cards",
    "version": "18.0.1.0.0",
    "depends": ["sale", "loyalty_card_report"],
}
loyalty_card_report/__manifest__.py
{
    "name": "Loyalty card report",
    "version": "18.0.1.0.0",
    "depends": ["loyalty_card"],
}

Each module depends on the other.

loyalty_card/__manifest__.py
{
    "name": "Loyalty cards",
    "version": "18.0.1.0.0",
    "depends": ["sale"],
}

loyalty_card_report keeps its dependency on loyalty_card. Whatever loyalty_card needed from the report moves into loyalty_card, or into a third module that both depend on.

Suppressing

"depends": ["sale", "loyalty_card_report"],  # odooscan: ignore[OD504]

See suppressing a finding.