unclecatvn/agent-skills / skills/odoo-19.0
odoo-19
VerifiedOdoo 19 development knowledge base with 18 specialized guides covering Actions (ir.actions.*, cron jobs, server actions), Controllers (HTTP routing, endpoints, auth types), Data files (XML/CSV records, shortcuts, noupdate), API Decorators (@api.depends, @api.constrains, @api.ondelete, @api.onchange, @api.model, @api.private), SQL Constraints (models.Constraint replacing _sql_constraints), Database Indexes (models.Index), Module development (manifest, wizards, reports), Field types (Char, Text, Monetary, relational fields), Manifest configuration (__manifest__.py, dependencies, asset bundles), Mixins (mail.thread, mail.activity.mixin, mail.alias.mixin, utm.mixin), ORM Model methods (search, CRUD, domain filters, recordsets, CamelCase model naming), Migration scripts (pre/post/end hooks, data migration), OWL frontend components (hooks, services, lifecycle), Performance optimization (N+1 prevention, batch ops, _read_group), QWeb Reports (PDF/HTML, paper formats, barcodes, t-out), Security/ACL (record rules, field permissions, privilege-based groups, @api.private), Testing (TransactionCase, HttpCase, mocking, query count assertions), Transactions (savepoints, UniqueViolation, serialization failures), Translations (i18n, PO files, translatable fields), XML Views (list/form/search, kanban card templates, xpath inheritance, QWeb templates). Use when writing, reviewing, or debugging any Odoo 19 Python or XML code, creating or modifying modules, fixing performance issues, or looking up Odoo 19 API patterns and best practices. Includes CSS/SCSS asset authoring and review for Odoo addons.
references/odoo-19-migration-guide.md
View on GitHub# Odoo 19 Migration Guide
Guide for migrating modules from Odoo 17/18 to Odoo 19.
## Table of Contents
- [Migration Overview](#migration-overview)
- [Key Changes](#key-changes)
- [Migration Scripts](#migration-scripts)
- [Module Hooks](#module-hooks)
- [Common Migrations](#common-migrations)
- [Testing](#testing)
---
## Migration Overview
### When to Migrate
- **Major version upgrade**: Odoo 17 → 18 → 19
- **Module dependencies changed**
- **API breaking changes**
### Migration Strategy
1. Review changelog and breaking changes
2. Update `__manifest__.py` version
3. Run migration scripts
4. Test thoroughly
5. Update documentation
---
## Key Changes
### Odoo 19 Key Changes
| Area | Change |
|------|--------|
| **List view** | Use `<list>` instead of `<tree>` |
| **Dynamic attributes** | Use direct attributes instead of `attrs` |
| **Delete validation** | Use `@api.ondelete` instead of overriding `unlink()` |
| **Field aggregation** | Use `aggregator=` instead of `group_operator=` |
| **SQL queries** | Use `odoo.tools.SQL` class |
| **Batch create** | Use list of dicts instead of single dict |
### Odoo 18 Key Changes
| Area | Change |
|------|--------|
| **Views** | Use `<list>` instead of `<tree>` |
| **attrs** | Deprecated, use direct attributes |
| **ondelete** | New `@api.ondelete` decorator |
---
## Migration Scripts
### Migration Script Location
```
my_module/
└── migrations/
└── 19.0.1.0/
├── pre-migration.py
├── end-migration.py
└── post-migration.py
```
### Migration Script Naming
| Script | When it runs |
|--------|--------------|
| `pre-migration.py` | Before module update |
| `post-migration.py` | After module update |
| `end-migration.py` | After all migrations |
### Migration Script Template
```python
def migrate(cr, version):
"""
Migration script for Odoo 19
"""
# Your migration code here
pass
```
---
## Common Migrations
### Tree to List View
**Odoo 17 and earlier**:
```xml
<tree string="Records">
<field name="name"/>
</tree>
```
**Odoo 18+**:
```xml
<list string="Records">
<field name="name"/>
</list>
```
### attrs to Direct Attributes
**Odoo 17 and earlier**:
```xml
<field name="state" attrs="{'invisible': [('state', '!=', 'draft')]}"/>
```
**Odoo 18+**:
```xml
<field name="state" invisible="state != 'draft'"/>
```
### Delete Validation
**Odoo 17 and earlier**:
```python
def unlink(self):
for record in self:
if record.state != 'draft':
raise UserError("Cannot delete non-draft records")
return super().unlink()
```
**Odoo 18+**:
```python
@api.ondelete(at_uninstall=False)
def _unlink_if_not_draft(self):
if any(rec.state != 'draft' for rec in self):
raise UserError("Cannot delete non-draft records")
```
### Field Aggregation
**Odoo 17 and earlier**:
```python
amount_total = fields.Monetary(group_operator="sum")
```
**Odoo 18+**:
```python
amount_total = fields.Monetary(aggregator="sum")
```
---
## Module Hooks
### pre_init_hook
```python
def pre_init_hook(env):
"""Called before module installation"""
# Create custom tables, etc.
pass
```
### post_init_hook
```python
def post_init_hook(env):
"""Called after module installation"""
# Set default values, create records, etc.
pass
```
### uninstall_hook
```python
def uninstall_hook(env):
"""Called after module uninstallation"""
# Clean up custom tables, files, etc.
pass
```
### Register Hooks in Manifest
```python
{
...
'pre_init_hook': 'my_module.pre_init_hook',
'post_init_hook': 'my_module.post_init_hook',
'uninstall_hook': 'my_module.uninstall_hook',
}
```
---
## Migration Checklist
- [ ] Review Odoo 19 changelog
- [ ] Update `__manifest__.py` version
- [ ] Update dependencies
- [ ] Rename `<tree>` to `<list>`
- [ ] Replace `attrs` with direct attributes
- [ ] Replace `unlink()` override with `@api.ondelete`
- [ ] Update field aggregators
- [ ] Update SQL queries to use `odoo.tools.SQL`
- [ ] Run migration scripts
- [ ] Test all functionality
- [ ] Update documentation
---
## Testing Migrations
### Test Migration Script
```python
from odoo.tests import TransactionCase
class TestMigration(TransactionCase):
def test_migration(self):
# Test migration script
pass
```
### Manual Testing
1. Install previous version with sample data
2. Update to Odoo 19
3. Verify all data migrated correctly
4. Test all features
---
## References
- Odoo 19 changelog
- Odoo 18 changelog
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |