Review Odoo code for correctness, security, performance, and Odoo 18 standards. Use when reviewing Odoo modules, diffs, or pull requests; produce a scored report with weighted criteria.
This skill has safety concerns that you should review before use. Some patterns were detected that may pose a risk.Safety score: 75/100.
KillerSkills scans all public content for safety. Use caution before installing or executing flagged content.
Review Odoo code changes against clear criteria, identify risks, and score using a weighted scale from an Odoo 18 expert perspective.
- **Models/ORM**: `odoo-18-model-guide.md`
- **Fields**: `odoo-18-field-guide.md`
- **Decorators**: `odoo-18-decorator-guide.md`
- **Performance**: `odoo-18-performance-guide.md`
- **Views/XML**: `odoo-18-view-guide.md`
- **Security**: `odoo-18-security-guide.md`
- **Controllers**: `odoo-18-controller-guide.md`
- **Transactions**: `odoo-18-transaction-guide.md`
- **Mixins**: `odoo-18-mixins-guide.md` (mail.thread, activities)
- **Testing**: `odoo-18-testing-guide.md`
- **Migration**: `odoo-18-migration-guide.md`
- **Actions**: `odoo-18-actions-guide.md`
- **Data Files**: `odoo-18-data-guide.md`
- **Manifest**: `odoo-18-manifest-guide.md`
1. **Scope**: Identify change scope, objectives, and key risks
2. **ORM & Model Methods**: Search patterns, CRUD operations, recordset operations
3. **Field Definitions**: Field types, computed fields, relational field parameters
4. **API Decorators**: @api.depends, @api.constrains, @api.ondelete (Odoo 18!)
5. **Performance**: N+1 detection, batch operations, field selection
6. **Transaction Management**: Savepoints, UniqueViolation, serialization
7. **Views & XML**: Odoo 18 tags (`<list>`), inheritance, structure
8. **Security**: ACL, record rules, exceptions, sudo usage
9. **Controllers**: Auth types, CSRF protection, routing
10. **Mixins**: mail.thread, mail.activity.mixin, mail.alias.mixin usage
11. **Testing**: Test coverage, proper test cases, @tagged decorators
12. **Migration**: Migration scripts, data migration patterns
13. **Actions**: Window actions, server actions, cron jobs
14. **Data Files**: XML/CSV data structure, noupdate, shortcuts
15. **Manifest**: Dependencies, external deps, hooks, assets
| Anti-Pattern | Consequence | Fix |
|--------------|-------------|-----|
| `search()` in loop | N+1 queries | Use `search_read()` with `IN` domain |
| `create()` in loop | N INSERT statements | Batch: `create([{...}, {...}])` |
| `write()` in loop | N UPDATE statements | `records.write({...})` |
| `unlink()` in loop | N DELETE statements | `records.unlink()` |
| Override `unlink()` for validation | Breaks module uninstall | Use `@api.ondelete(at_uninstall=False)` |
| `@api.depends('a')` then access `a.b` | N queries | Add `@api.depends('a.b')` |
| `@api.constrains('a.b')` | Not supported | Use only `@api.constrains('a')` |
| `<tree>` in Odoo 18 | Deprecated | Use `<list>` |
| `Float` for currency | Precision issues | Use `Monetary` |
| Missing `ondelete` on Many2one | Orphan records | Add `ondelete='cascade/restrict'` |
| Generic `Exception` | Poor UX | Use `UserError`, `ValidationError` |
| Continue after UniqueViolation without savepoint | Transaction aborted | Use `with self.env.cr.savepoint():` |
| Direct chatter manipulation instead of message_post | Breaks mail.thread features | Use `message_post()` with proper subtype |
| Missing `tracking=True` on tracked fields | No field tracking in chatter | Add `tracking=True` to field definition |
| Tests without `@tagged` decorators | Wrong test environment | Add `@tagged('standard')`, `@tagged('post_install')` |
| Non-idempotent migration script | Fails on re-run | Use `if not field_exists:` checks |
| Missing `noupdate="1"` on reference data | Data overwritten on update | Add `noupdate="1"` to reference records |
| Cron without `interval_number` and `interval_type` | Never runs | Add proper interval configuration |
**Criteria** (score 1-10):
**Total calculation**:
```
total = 0.28*orm + 0.14*fields + 0.14*decorators + 0.18*performance + 0.10*transaction + 0.04*views + 0.06*security + 0.06*controllers
```
**Score anchors**:
```
```
When reviewing, thoroughly check:
1. **Does @api.depends have complete dependencies?**
- Check dotted paths: `partner_id.email` instead of just `partner_id`
- Missing dependencies cause N queries
- Reference: `dev/odoo-18-decorator-guide.md`
2. **Are there N+1 queries?**
- Loop with `search()`, `browse()`, `read()` inside
- Solution: `search_read()` with `IN` domain or `read_group()`
- Reference: `dev/odoo-18-performance-guide.md`
3. **Are there batch operations?**
- `create()`, `write()`, `unlink()` in loop
- Solution: Batch operations on recordset
- Reference: `dev/odoo-18-performance-guide.md`
4. **Is transaction safe?**
- UniqueViolation handling without savepoint
- Concurrent updates without advisory lock
- Reference: `dev/odoo-18-transaction-guide.md`
5. **Are Odoo 18 patterns correct?**
- Use `<list>` instead of `<tree>`
- Use `@api.ondelete()` instead of overriding `unlink()`
- Use `@api.model_create_multi` for batch create
- Reference: `dev/odoo-18-view-guide.md`
6. **Are field definitions correct?**
- `Monetary` with `currency_field`
- `Many2one` with `ondelete`
- Computed field with `store=True` if needed
- Reference: `dev/odoo-18-field-guide.md`
7. **Is exception handling correct?**
- `UserError`, `ValidationError`, `AccessError`
- No generic `Exception`
- Reference: `dev/odoo-18-security-guide.md`
8. **Are mixins properly configured?**
- `mail.thread` with proper tracking fields
- `mail.activity.mixin` for activities
- `mail.alias.mixin` with alias fields
- Reference: `dev/odoo-18-mixins-guide.md`
9. **Is testing adequate?**
- Tests for new functionality
- Proper use of `@tagged` decorators
- Query count assertions for performance
- Reference: `dev/odoo-18-testing-guide.md`
10. **Are migrations handled correctly?**
- Proper migration script location
- Pre/post migration scripts
- Idempotent operations
- Reference: `dev/odoo-18-migration-guide.md`
11. **Are actions properly defined?**
- Window actions with correct context
- Server actions for automation
- Cron jobs with proper intervals
- Reference: `dev/odoo-18-actions-guide.md`
12. **Are data files correct?**
- Proper XML record structure
- `noupdate="1"` for reference data
- CSV data properly formatted
- Reference: `dev/odoo-18-data-guide.md`
13. **Is manifest correct?**
- All dependencies declared
- External dependencies listed
- Hooks properly configured
- Reference: `dev/odoo-18-manifest-guide.md`
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/odoo-code-review/raw