Skip to content

prohibited-method-override (ODOO055)

Preview (since 0.16.2.8) · 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 overrides of methods listed in the lint.odoo.prohibited-override-methods setting: methods that delegate to super().<method>(...) while their name is on the prohibited list.

Why is this bad?

Some projects mark specific ORM or business methods as sealed: overriding them has caused regressions before, or the project wants all changes to go through other extension points (e.g. dedicated hooks) instead.

Example

Given prohibited-override-methods = ["action_post"]:

class AccountMove(models.Model):
    _inherit = "account.move"

    def action_post(self):
        return super().action_post()

Options