Skip to content

no-wizard-in-models (ODOO050)

Preview (since 0.16.2.5) · 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 TransientModel (wizard) classes defined inside the models/ directory of an Odoo module.

Why is this bad?

The OCA module structure keeps wizards in the wizards/ directory; mixing them into models/ makes the module layout harder to navigate.

Classes extending the settings screens (_inherit starting with res.config) are exempt: those conventionally live with the models.

Example

A models/sale_import.py file containing:

class SaleImport(models.TransientModel):
    _name = "sale.import"

Use instead a wizards/sale_import.py file containing:

class SaleImport(models.TransientModel):
    _name = "sale.import"