Skip to content

consider-merging-classes-inherited (ODOO063)

Preview (since 0.16.2.11) · Related issues · View source

Derived from the odoo linter.

This rule is unstable and in preview. The --preview flag is required for use.

What it does

Checks for multiple Odoo model extension classes in the same module that use the same _inherit model name.

Why is this bad?

Splitting the extension of a single Odoo model across several classes in the same module makes the module harder to read and maintain. In most cases, the classes can be merged into one extension class for that inherited model.

Example

class ResPartnerA(models.Model):
    _inherit = "res.partner"


class ResPartnerB(models.Model):
    _inherit = "res.partner"

Use instead:

class ResPartner(models.Model):
    _inherit = "res.partner"