Skip to content

invalid-commit (ODOO017)

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 direct calls to cr.commit() (or self.cr.commit(), self._cr.commit(), self.env.cr.commit()).

Why is this bad?

Committing the transaction directly bypasses Odoo's own transaction management and can leave the database in an inconsistent state if a later step fails.

Example

self.env.cr.commit()