Skip to content

translation-field (ODOO031)

Preview (since 0.16.2.2) · 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 _() translation calls inside field definitions.

Why is this bad?

Field attribute strings (like string= and help=) are translated automatically by Odoo's export machinery; wrapping them in _() is unnecessary and translates them at module-load time, before the user's language is even known.

Example

name = fields.Char(string=_("Name"))

Use instead:

name = fields.Char(string="Name")