Odoo Coding Guidelines
Use this skill when the user asks to review, check, write, or validate Odoo code against official coding standards.
Source: https://www.odoo.com/documentation/19.0/contributing/development/coding_guidelines.html
Load sub-files based on what is being reviewed:
- Python files, models, fields, methods → read python.md
- XML views, data files, templates → read xml.md
- JavaScript files → read javascript.md
- CSS / SCSS files → read css.md
- Full code review or checklist requested → read checklist.md
- Module structure, file naming, directory layout → read structure.md
For mixed reviews (e.g. a whole module), load all relevant files.
General Principles
Language
- All code must be in English: variable names, field names, method names, model names, comments, commit messages, XML IDs, and string literals used as technical identifiers.
Comments
- Comments must explain WHY, never WHAT. The code itself should be readable enough to convey what it does.
- If a comment is needed to explain what a block of code does, refactor the code until it is self-explanatory, then remove the comment.
- Acceptable comments: hidden constraints, non-obvious invariants, workarounds for specific bugs, behavior that would surprise a reader.
Naming
1---2name: odoo-coding-guidelines3description: Official Odoo coding standards for reviewing, checking, or writing Python, XML, JavaScript, and CSS/SCSS, plus module structure and a full-review checklist.4---56# Odoo Coding Guidelines78Use this skill when the user asks to **review, check, write, or validate Odoo code** against official coding standards.9Source: https://www.odoo.com/documentation/19.0/contributing/development/coding_guidelines.html1011Load sub-files based on what is being reviewed:12- Python files, models, fields, methods → read [python.md](python.md)13- XML views, data files, templates → read [xml.md](xml.md)14- JavaScript files → read [javascript.md](javascript.md)15- CSS / SCSS files → read [css.md](css.md)16- Full code review or checklist requested → read [checklist.md](checklist.md)17- Module structure, file naming, directory layout → read [structure.md](structure.md)1819For mixed reviews (e.g. a whole module), load all relevant files.2021---2223## General Principles2425### Language26- **All code must be in English**: variable names, field names, method names, model names, comments, commit messages, XML IDs, and string literals used as technical identifiers.2728### Comments29- Comments must explain **WHY**, never WHAT. The code itself should be readable enough to convey what it does.30- If a comment is needed to explain what a block of code does, **refactor** the code until it is self-explanatory, then remove the comment.31- Acceptable comments: hidden constraints, non-obvious invariants, workarounds for specific bugs, behavior that would surprise a reader.3233### Naming34- **Never truncate names** to save keystrokes. Autocomplete makes long names free — short names cost readability.35 ```python36 # ❌37 def comp_tot_amt(self): ...38 inv_dt = fields.Date(...)3940 # ✅41 def _compute_total_amount(self): ...42 invoice_date = fields.Date(...)43 ```44