Settings
Options read by the OD rules. Every other Ruff option is documented at docs.astral.sh/ruff/settings.
lint.odoo
Options for the odoo plugin.
attribute-deprecated
The model attributes reported as deprecated (ODW8105). Setting it replaces the built-in list.
Default value: ["_columns", "_defaults", "length"]
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# `length` is still in use here.
attribute-deprecated = ["_columns", "_defaults"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# `length` is still in use here.
attribute-deprecated = ["_columns", "_defaults"]
```
category-allowed
A list of categories allowed in a module's manifest (ODC8114). While the list is
empty the rule is inert, so a project only opts in by naming its categories.
Default value: []
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# Only these categories may appear in a manifest.
category-allowed = ["Accounting", "Sales", "Warehouse"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# Only these categories may appear in a manifest.
category-allowed = ["Accounting", "Sales", "Warehouse"]
```
cursor-expr
The expressions that denote a database cursor (ODE8102, ODE8103). Setting it replaces the built-in list.
Default value: ["cr", "self._cr", "self.cr", "self.env.cr"]
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# This codebase reaches the cursor through a helper.
cursor-expr = ["self.env.cr", "self._db.cursor"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# This codebase reaches the cursor through a helper.
cursor-expr = ["self.env.cr", "self._db.cursor"]
```
deprecated-field-parameters
The renamed field parameters, each written as old:new (ODW8111). Setting it replaces the built-in list.
Default value: ["digits_compute:digits", "select:index"]
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# A parameter our own base module renamed.
deprecated-field-parameters = ["digits_compute:digits", "select:index", "oldname:string"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# A parameter our own base module renamed.
deprecated-field-parameters = ["digits_compute:digits", "select:index", "oldname:string"]
```
deprecated-odoo-model-methods
The model methods reported as deprecated. Setting it drops the version gating the built-in list carries, so the methods named here are reported whatever the configured odoo-version is (ODW8160). Setting it replaces the built-in list.
Default value: ["fields_view_get"]
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# Also flag a method our own base module retired.
deprecated-odoo-model-methods = ["fields_view_get", "get_formview_id"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# Also flag a method our own base module retired.
deprecated-odoo-model-methods = ["fields_view_get", "get_formview_id"]
```
development-status-allowed
The values development_status may take (ODC8111). Setting it replaces the built-in list.
Default value: ["Alpha", "Beta", "Mature", "Production/Stable"]
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# We never ship anything below Beta.
development-status-allowed = ["Beta", "Production/Stable"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# We never ship anything below Beta.
development-status-allowed = ["Beta", "Production/Stable"]
```
external-request-timeout-methods
The calls that must pass a timeout, as dotted paths (ODE8106). Setting it replaces the built-in list.
Default value: ["ftplib.FTP", "http.client.HTTPConnection", "requests.get", "requests.post", "..."]
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# Our HTTP helper wraps requests and needs one as well.
external-request-timeout-methods = ["requests.get", "requests.post", "myaddon.http.fetch"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# Our HTTP helper wraps requests and needs one as well.
external-request-timeout-methods = ["requests.get", "requests.post", "myaddon.http.fetch"]
```
external-request-timeout-seconds
The number of seconds the external-request-timeout (ODE8106) fix passes as timeout= when inserting the missing argument.
Default value: 120
Type: int
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# Fail faster than the default two minutes.
external-request-timeout-seconds = 30
```
=== "ruff.toml"
```toml
[lint.odoo]
# Fail faster than the default two minutes.
external-request-timeout-seconds = 30
```
license-allowed
The licenses a manifest may declare (ODC8105). Setting it replaces the built-in list,
which holds the licenses pylint-odoo accepts.
Default value: ["AGPL-3", "GPL-2", "GPL-2 or any later version", "GPL-3", "GPL-3 or any later version", "LGPL-3", "OEEL-1", "Other OSI approved licence", "Other proprietary"]
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# We also ship modules under the Odoo Proprietary License.
license-allowed = ["AGPL-3", "LGPL-3", "OEEL-1", "OPL-1"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# We also ship modules under the Odoo Proprietary License.
license-allowed = ["AGPL-3", "LGPL-3", "OEEL-1", "OPL-1"]
```
manifest-deprecated-keys
The manifest keys reported as deprecated (ODC8103). Setting it replaces the built-in
list — active and description for every version, plus qweb from Odoo 16.0 on —
and the keys named here are then reported whatever the configured odoo-version is.
Default value: ["active", "description", "qweb"]
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# Leave `qweb` alone, and deprecate a key of our own.
manifest-deprecated-keys = ["active", "description", "demo_xml"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# Leave `qweb` alone, and deprecate a key of our own.
manifest-deprecated-keys = ["active", "description", "demo_xml"]
```
manifest-keys-values-true
The manifest keys whose default value is True, so that spelling them out is superfluous (ODC8116). Setting it replaces the built-in list.
Default value: ["active", "installable"]
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# `installable` is worth stating explicitly in this project.
manifest-keys-values-true = ["active"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# `installable` is worth stating explicitly in this project.
manifest-keys-values-true = ["active"]
```
manifest-required-authors
The authors a manifest must name at least one of (ODC8101). Setting it replaces the
built-in list, which holds the single author pylint-odoo requires.
Default value: ["Odoo Community Association (OCA)"]
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# Modules are ours, or the OCA's.
manifest-required-authors = ["Vauxoo", "Odoo Community Association (OCA)"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# Modules are ours, or the OCA's.
manifest-required-authors = ["Vauxoo", "Odoo Community Association (OCA)"]
```
manifest-required-keys
The keys a manifest must declare (ODC8102). Setting it replaces the built-in list.
Default value: ["license"]
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# Every module must declare who wrote it, too.
manifest-required-keys = ["license", "author"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# Every module must declare who wrote it, too.
manifest-required-keys = ["license", "author"]
```
method-required-super
The methods whose override must call super() (ODW8106). Setting it replaces the built-in list.
Default value: ["copy", "create", "default_get", "init", "read", "setUp", "setUpClass", "tearDown", "tearDownClass", "unlink", "write"]
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# Only the ORM writes matter to us.
method-required-super = ["create", "write", "unlink"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# Only the ORM writes matter to us.
method-required-super = ["create", "write", "unlink"]
```
no-missing-return
The methods exempt from returning the value of the super() call they make (ODW8110). Setting it replaces the built-in list.
Default value: ["__init__", "_register_hook", "setUp", "setUpClass", "tearDown", "tearDownClass"]
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# Our own setup helper never returns either.
no-missing-return = ["__init__", "setUp", "_setup_company"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# Our own setup helper never returns either.
no-missing-return = ["__init__", "setUp", "_setup_company"]
```
no-search-all-models
The models no-search-all (ODW8163) reports an unlimited search([]) on. Entries are matched as globs, so account.move* covers account.move and account.move.line. A call whose model cannot be resolved is never reported. Setting it replaces the built-in list.
Default value: ["account.analytic.line", "account.bank.statement.line", "account.full.reconcile", "account.invoice*", "account.move*", "account.partial.reconcile", "account.payment", "bus.bus", "calendar.attendee", "calendar.event", "crm.lead", "data_merge.group", "data_merge.record", "documents.access", "documents.document", "event.registration", "helpdesk.ticket", "hr.attendance", "hr.expense", "hr.leave", "hr.payslip*", "hr.work.entry", "ir.attachment", "ir.cron.progress", "ir.logging", "ir.model.data", "ir.property", "ir.translation", "l10n_mx_edi.document", "link.tracker.click", "mail.followers", "mail.mail", "mail.mail.statistics", "mail.message", "mail.notification", "mail.tracking.email", "mail.tracking.event", "mail.tracking.value", "mailing.contact", "mailing.mailing", "mailing.subscription", "mailing.trace", "marketing.trace", "mrp.production", "mrp.workorder", "payment.token", "payment.transaction", "pos.order*", "pos.payment", "procurement.group", "product.price.history", "product.pricelist.item", "product.product", "product.supplierinfo", "product.template", "project.task", "purchase.order*", "queue.job", "rating.rating", "res.device.log", "res.partner", "res.users.log", "sale.order*", "sign.request*", "sms.sms", "stock.lot", "stock.move*", "stock.picking", "stock.production.lot", "stock.quant", "stock.valuation.layer", "stock.warehouse.orderpoint", "survey.user_input*", "website.track", "website.visitor"]
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# Only the two tables that actually hurt in this database.
no-search-all-models = ["account.move*", "stock.move*"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# Only the two tables that actually hurt in this database.
no-search-all-models = ["account.move*", "stock.move*"]
```
odoo-exceptions
The exceptions whose message must be translated (ODC8107). Setting it replaces the built-in list.
Default value: ["AccessDenied", "AccessError", "CacheMiss", "MissingError", "RedirectWarning", "UserError", "ValidationError", "Warning", "except_orm"]
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# Our own exception carries a user-facing message too.
odoo-exceptions = ["UserError", "ValidationError", "PaymentError"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# Our own exception carries a user-facing message too.
odoo-exceptions = ["UserError", "ValidationError", "PaymentError"]
```
odoo-required-files
A list of files every Odoo module must ship (ODC8115), as paths relative to the
module directory. While the list is empty the rule is inert.
Default value: []
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# Every module must have a description page.
odoo-required-files = ["static/description/index.html"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# Every module must have a description page.
odoo-required-files = ["static/description/index.html"]
```
odoo-version
The targeted Odoo version, used to suppress rules that only apply to a specific
range of Odoo versions (e.g. deprecated-self-cr only applies since 19.0).
Default value: null
Type: str
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# Target Odoo 17.0.
odoo-version = "17.0"
```
=== "ruff.toml"
```toml
[lint.odoo]
# Target Odoo 17.0.
odoo-version = "17.0"
```
prohibited-override-methods
A list of method names whose override is prohibited (ODW8107). A method
counts as an override when its body delegates to super().<method>(...).
Default value: []
Type: list[str]
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
# Flag overrides of `action_post`.
prohibited-override-methods = ["action_post"]
```
=== "ruff.toml"
```toml
[lint.odoo]
# Flag overrides of `action_post`.
prohibited-override-methods = ["action_post"]
```
readme-template-url
The README template pointed at by missing-readme (ODC8112) when a module has none.
Unset, the diagnostic just reports the missing file.
Default value: null
Type: str
Example usage:
=== "pyproject.toml"
```toml
[tool.ruff.lint.odoo]
readme-template-url = "https://github.com/Vauxoo/templates/blob/main/README.md"
```
=== "ruff.toml"
```toml
[lint.odoo]
readme-template-url = "https://github.com/Vauxoo/templates/blob/main/README.md"
```