odoo-addons-relative-import (W8150)#

A module imports itself through odoo.addons.<module>.

What it does#

Reports imports of the module’s own code through odoo.addons.<module>. Files directly in tests/ and migration scripts are skipped.

Why is this bad?#

The absolute import breaks when the module folder is renamed or installed under another name, and hides that the import is local.

Example#

In module acme_sale:

from odoo.addons.acme_sale.models.sale import helper

Use instead:

from ..models.sale import helper