Odoo Code Review
Use this skill for Odoo-specific code review. Findings come first. Focus on bugs, security risks, behavioral regressions, performance problems, migration hazards, and missing tests before style cleanup.
Official Odoo coding guidelines are still covered by ODOO-CODING-GUIDELINES.md, but review scope is broader than style.
First Move
Identify:
- target Odoo version
- addon/module scope
- changed files or diff range
- stable branch vs development branch
- repo-specific conventions and checks
- available local framework/tooling context:
$ODOO_SOURCE, $ODOO_TOOL_README, $ODOO_BASE_COMMAND
If a version-specific reference skill exists, consult it before reviewing version-sensitive behavior:
- Odoo 17:
odoo-17.0
- Odoo 18:
odoo-18.0
- Odoo 19:
odoo-19.0
If $ODOO_SOURCE is set, inspect local framework code for APIs, XML syntax, assets, test helpers, and version-specific behavior before relying on memory.
Review Workflow
- Determine the review target: whole addon, diff, PR, commit range, or specific files.
- Read the module manifest first, then relevant imports, models, views, security, data, controllers, tests, assets, reports, and docs.
- Check official style/guideline concerns with ODOO-CODING-GUIDELINES.md.
- Check Odoo behavior risks with the review checklist below.
- Return findings ordered by severity with file/line references.
- State checks run, checks not run, and residual review gaps.
Stable Branch Rule
When reviewing stable branches, do not ask for noisy restyling. Existing file style supersedes generic formatting preferences. Focus on changed code, correctness, security, maintainability, and obvious guideline violations.
In development branches, apply guidelines more broadly to modified code. Recommend restructuring only when it reduces real risk or the user asks for a wider cleanup.
Odoo Review Checklist
Models And ORM
- Model names,
_inherit, and _inherits match real domain boundaries.
- Batch operations are used for multi-record flows.
- No
search(), browse(), create(), write(), or unlink() inside loops unless bounded and justified.
- Domains are correct, indexed where relevant, and multi-company-safe.
sudo() is used only at explicit trust boundaries and does not leak records.
- Direct SQL is parameterized and justified.
Fields, Computes, Constraints, And Decorators
@api.depends lists complete dependencies, including dotted paths where required.
@api.constrains uses supported field names and raises ValidationError.
- Stored computed fields are intentional and searchable/groupable when needed.
- Monetary fields use currency fields; relational fields have correct inverse/ondelete behavior.
- Unlink validation uses version-appropriate hooks such as
@api.ondelete where applicable.
XML, Views, Actions, And Data
- View inheritance targets stable anchors and uses syntax valid for the target Odoo version.
- Actions, menus, reports, cron jobs, and server actions reference existing XML IDs.
- Manifest data order is load-safe: groups/security XML, ACLs, base data, views, actions, menus.
- Production data, demo data, and
noupdate reference data are separated correctly.
- User-facing strings are translatable.
Security And Access
- Persistent models have appropriate
ir.model.access.csv entries.
- Record rules match realistic users, groups, and company contexts.
- Portal/public controllers explicitly validate identity, ownership, auth mode, CSRF needs, and input.
- Groups, ACLs, record rules, domains,
sudo(), and multi-company isolation are reviewed together.
- Exceptions use Odoo exception classes:
UserError, ValidationError, AccessError, etc.
Controllers, Reports, OWL, And Assets
- Controllers use correct
auth, route type, methods, CSRF behavior, and response handling.
- Report rendering checks access before rendering and avoids unsafe context/data leakage.
- Asset bundles include the right JS/XML/SCSS files for the target Odoo version.
- OWL components keep state/props/events clear and clean up listeners or async work.
Performance, Transactions, And Concurrency
- Large recordsets avoid N+1 queries and per-record writes.
- Aggregations use Odoo-native tools such as
_read_group/read_group where appropriate for the version.
- Database errors that may abort transactions are isolated with savepoints.
- Concurrency-sensitive operations have realistic locking or retry behavior.
- No business method calls
self.env.cr.commit() unless explicitly required by Odoo framework semantics.
Tests, Migration, Manifest, And Docs
- Tests cover behavior seams: ORM workflows, access rules, controllers, reports, module updates, or frontend flows.
- Test tags and base classes match repo/Odoo conventions.
- OCA migrations keep compatibility changes separate from behavior changes.
- Manifest dependencies match imports, inherited models, XML refs, data files, and assets.
- Docs and manifest claims are supported by implemented code.
Optional Scoring
Use scoring only when the user asks for a scored review. Otherwise, findings-first review is preferred.
Suggested weighted score:
total = 0.25*correctness + 0.20*security + 0.15*performance + 0.10*transactions + 0.10*views_data + 0.10*tests + 0.10*maintainability
Output Format
## Findings
- Critical: `path/file.py:XX` - issue, why it matters, suggested fix.
- Major: `path/file.xml:XX` - issue, why it matters, suggested fix.
- Minor: `path/file.py:XX` - issue, why it matters, suggested fix.
## Open Questions
- Only include questions that affect review correctness.
## Checks Run
- Commands or manual review scope.
## Residual Risks
- Areas not reviewed or not verifiable from available context.
## Summary
- Brief change-quality summary after findings.
If there are no findings, say No findings and mention the review scope and residual risks.
Response Rules
- Cite exact files and lines for every finding.
- Do not bury bugs under style suggestions.
- Do not recommend broad refactors unless tied to a concrete Odoo risk.
- State assumptions instead of guessing.
- If the issue is execution-flow uncertainty, compose with
odoo-code-tracer.
- If the issue is missing or weak test coverage, compose with
odoo-test-writer.
1---
2name: odoo-code-review
3description: Review Odoo addon code for correctness, security, performance, migrations, tests, and official Odoo coding guidelines. Use when reviewing Odoo modules, diffs, pull requests, or changed files involving models, fields, XML views, data, controllers, reports, OWL/assets, manifests, access rules, record rules, or OCA migrations.
4metadata:
5 source: https://skillmd.com/skills/aibot88/odoo-code-review
6---
7
8# Odoo Code Review
9
10Use this skill for Odoo-specific code review. Findings come first. Focus on bugs, security risks, behavioral regressions, performance problems, migration hazards, and missing tests before style cleanup.
11
12Official Odoo coding guidelines are still covered by [ODOO-CODING-GUIDELINES.md](ODOO-CODING-GUIDELINES.md), but review scope is broader than style.
13
14## First Move
15
16Identify:
17
18- target Odoo version
19- addon/module scope
20- changed files or diff range
21- stable branch vs development branch
22- repo-specific conventions and checks
23- available local framework/tooling context: `$ODOO_SOURCE`, `$ODOO_TOOL_README`, `$ODOO_BASE_COMMAND`
24
25If a version-specific reference skill exists, consult it before reviewing version-sensitive behavior:
26
27- Odoo 17: `odoo-17.0`
28- Odoo 18: `odoo-18.0`
29- Odoo 19: `odoo-19.0`
30
31If `$ODOO_SOURCE` is set, inspect local framework code for APIs, XML syntax, assets, test helpers, and version-specific behavior before relying on memory.
32
33## Review Workflow
34
351. Determine the review target: whole addon, diff, PR, commit range, or specific files.
362. Read the module manifest first, then relevant imports, models, views, security, data, controllers, tests, assets, reports, and docs.
373. Check official style/guideline concerns with [ODOO-CODING-GUIDELINES.md](ODOO-CODING-GUIDELINES.md).
384. Check Odoo behavior risks with the review checklist below.
395. Return findings ordered by severity with file/line references.
406. State checks run, checks not run, and residual review gaps.
41
42## Stable Branch Rule
43
44When reviewing stable branches, do not ask for noisy restyling. Existing file style supersedes generic formatting preferences. Focus on changed code, correctness, security, maintainability, and obvious guideline violations.
45
46In development branches, apply guidelines more broadly to modified code. Recommend restructuring only when it reduces real risk or the user asks for a wider cleanup.
47
48## Odoo Review Checklist
49
50### Models And ORM
51
52- Model names, `_inherit`, and `_inherits` match real domain boundaries.
53- Batch operations are used for multi-record flows.
54- No `search()`, `browse()`, `create()`, `write()`, or `unlink()` inside loops unless bounded and justified.
55- Domains are correct, indexed where relevant, and multi-company-safe.
56- `sudo()` is used only at explicit trust boundaries and does not leak records.
57- Direct SQL is parameterized and justified.
58
59### Fields, Computes, Constraints, And Decorators
60
61- `@api.depends` lists complete dependencies, including dotted paths where required.
62- `@api.constrains` uses supported field names and raises `ValidationError`.
63- Stored computed fields are intentional and searchable/groupable when needed.
64- Monetary fields use currency fields; relational fields have correct inverse/ondelete behavior.
65- Unlink validation uses version-appropriate hooks such as `@api.ondelete` where applicable.
66
67### XML, Views, Actions, And Data
68
69- View inheritance targets stable anchors and uses syntax valid for the target Odoo version.
70- Actions, menus, reports, cron jobs, and server actions reference existing XML IDs.
71- Manifest data order is load-safe: groups/security XML, ACLs, base data, views, actions, menus.
72- Production data, demo data, and `noupdate` reference data are separated correctly.
73- User-facing strings are translatable.
74
75### Security And Access
76
77- Persistent models have appropriate `ir.model.access.csv` entries.
78- Record rules match realistic users, groups, and company contexts.
79- Portal/public controllers explicitly validate identity, ownership, auth mode, CSRF needs, and input.
80- Groups, ACLs, record rules, domains, `sudo()`, and multi-company isolation are reviewed together.
81- Exceptions use Odoo exception classes: `UserError`, `ValidationError`, `AccessError`, etc.
82
83### Controllers, Reports, OWL, And Assets
84
85- Controllers use correct `auth`, route type, methods, CSRF behavior, and response handling.
86- Report rendering checks access before rendering and avoids unsafe context/data leakage.
87- Asset bundles include the right JS/XML/SCSS files for the target Odoo version.
88- OWL components keep state/props/events clear and clean up listeners or async work.
89
90### Performance, Transactions, And Concurrency
91
92- Large recordsets avoid N+1 queries and per-record writes.
93- Aggregations use Odoo-native tools such as `_read_group`/`read_group` where appropriate for the version.
94- Database errors that may abort transactions are isolated with savepoints.
95- Concurrency-sensitive operations have realistic locking or retry behavior.
96- No business method calls `self.env.cr.commit()` unless explicitly required by Odoo framework semantics.
97
98### Tests, Migration, Manifest, And Docs
99
100- Tests cover behavior seams: ORM workflows, access rules, controllers, reports, module updates, or frontend flows.
101- Test tags and base classes match repo/Odoo conventions.
102- OCA migrations keep compatibility changes separate from behavior changes.
103- Manifest dependencies match imports, inherited models, XML refs, data files, and assets.
104- Docs and manifest claims are supported by implemented code.
105
106## Optional Scoring
107
108Use scoring only when the user asks for a scored review. Otherwise, findings-first review is preferred.
109
110Suggested weighted score:
111
112```text
113total = 0.25*correctness + 0.20*security + 0.15*performance + 0.10*transactions + 0.10*views_data + 0.10*tests + 0.10*maintainability
114```
115
116## Output Format
117
118```markdown
119## Findings
120- Critical: `path/file.py:XX` - issue, why it matters, suggested fix.
121- Major: `path/file.xml:XX` - issue, why it matters, suggested fix.
122- Minor: `path/file.py:XX` - issue, why it matters, suggested fix.
123
124## Open Questions
125- Only include questions that affect review correctness.
126
127## Checks Run
128- Commands or manual review scope.
129
130## Residual Risks
131- Areas not reviewed or not verifiable from available context.
132
133## Summary
134- Brief change-quality summary after findings.
135```
136
137If there are no findings, say `No findings` and mention the review scope and residual risks.
138
139## Response Rules
140
141- Cite exact files and lines for every finding.
142- Do not bury bugs under style suggestions.
143- Do not recommend broad refactors unless tied to a concrete Odoo risk.
144- State assumptions instead of guessing.
145- If the issue is execution-flow uncertainty, compose with `odoo-code-tracer`.
146- If the issue is missing or weak test coverage, compose with `odoo-test-writer`.