Skip to content

context-overridden (ODOO018)

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 with_context(some_dict) calls with a single positional argument.

Why is this bad?

A single positional dict argument to with_context replaces the context wholesale instead of merging into it — with_context(**some_dict) or with_context(key=value) is almost always what's intended.

Example

self.with_context(ctx)

Use instead:

self.with_context(**ctx)