odoo-backend-standards
Installation
SKILL.md
Odoo Python Coding Standards
These standards adapt our core Python coding guidelines specifically for Odoo development, aligning with both modern Python practices and the official Odoo Coding Guidelines.
Imports
- Order: Standard Library → Odoo (
odoo,odoo.exceptions,odoo.http,odoo.models,odoo.fields,odoo.api) → Third Party → Local/Relative. - Top-level by default: Always use top-level imports. Local imports are permitted ONLY when strictly required to break a circular dependency or to avoid crashing a module load if a specific external dependency is missing.
- Ruff/Isort: Maintain
Irules forisortwhere applicable, ensuring Odoo imports are treated as their own distinct category or primary third-party block. Do NOT fight the linter.
Typing & Docstrings
- Type Hints: While Odoo relies heavily on dynamic recordsets (
self), type hint external utility functions, controller responses, and domain helpers. For Odoo models, type hints are less idiomatic but acceptable for simple business logic methods. - Recordsets: When type-hinting Odoo recordsets in custom Python helpers, you can use strings or generic placeholders if using Odoo 15+.
- Docstrings:
- Required: Every model, controller, and major business method must have a docstring.
- Compute/Onchange: Briefly explain what triggers it and what it calculates.