prefer-env-attribute (ODOO067)
Preview (since 0.16.2.14) · Related issues · View source
Derived from the odoo linter.
Fix is always available.
This rule is unstable and in preview. The --preview flag is required for use.
What it does
Checks for the _cr, _uid and _context shortcuts on a recordset or on request.
Why is this bad?
Odoo 19.0 deprecated all three in favor of reading them off the environment. They are
plain aliases — BaseModel._cr is literally return self.env.cr — so the rewrite is
behavior-preserving.
Example
Use instead: