Skip to content

no-search-all (ODOO038)

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 search([])/search_read([]) calls with an empty domain and no limit.

Why is this bad?

An empty domain without a limit loads all records of the model, which can be a serious performance problem on large tables.

Example

partners = self.env["res.partner"].search([])

Use instead:

partners = self.env["res.partner"].search([], limit=100)