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-view-guide.md
View on GitHub# Odoo 19 View Guide
## Coding Conventions
- Use model-first IDs such as `my_model_view_list` and matching dotted names
such as `my.model.list`; name inherited views after the model and feature.
- Use `<list>` and `list,form` in normal Odoo 19 examples. Keep field order
task-oriented and use direct modifier expressions rather than `attrs`.
Guide for creating views in Odoo 19: list, form, search, kanban, calendar, graph, pivot, and QWeb templates.
## Table of Contents
- [View Types](#view-types)
- [List Views](#list-views)
- [Form Views](#form-views)
- [Search Views](#search-views)
- [Kanban Views](#kanban-views)
- [Calendar Views](#calendar-views)
- [Graph Views](#graph-views)
- [Pivot Views](#pivot-views)
- [View Inheritance](#view-inheritance)
- [QWeb Templates](#qweb-templates)
---
## View Types
| Type | Tag | Description |
| -------- | ------------ | ------------------------------ |
| List | `<list>` | Table view (formerly `<tree>`) |
| Form | `<form>` | Single record view |
| Search | `<search>` | Search/filter view |
| Kanban | `<kanban>` | Card-based view |
| Calendar | `<calendar>` | Calendar view |
| Graph | `<graph>` | Chart view |
| Pivot | `<pivot>` | Pivot table view |
| Activity | `<activity>` | Activity view |
| QWeb | `<template>` | HTML/PDF template |
---
## List Views
### Basic List View
```xml
<record id="my_model_view_list" model="ir.ui.view">
<field name="name">my.model.list</field>
<field name="model">my.model</field>
<field name="arch" type="xml">
<list string="My Models">
<field name="name"/>
<field name="code"/>
<field name="date"/>
</list>
</field>
</record>
```
### List View Options
```xml
<list string="My Models" editable="bottom" multi_edit="1" limit="80">
<field name="name"/>
<field name="code"/>
</list>
```
| Option | Description |
| ------------ | ---------------------------------- |
| `editable` | `top` or `bottom`: inline editing |
| `multi_edit` | Enable multi-row editing |
| `limit` | Default records per page |
| `create` | Show create button (default: true) |
### Decoration
```xml
<list string="My Models">
<field name="state" decoration-success="state == 'done'"
decoration-warning="state == 'pending'"
decoration-danger="state == 'cancelled'"/>
<field name="name"/>
</list>
```
| Decoration | Description |
| -------------------- | ------------- |
| `decoration-success` | Green |
| `decoration-warning` | Yellow/Orange |
| `decoration-danger` | Red |
| `decoration-info` | Blue |
| `decoration-muted` | Grey |
| `decoration-bf` | Bold font |
| `decoration-it` | Italic font |
### Optional Fields
```xml
<list string="My Models">
<field name="name"/>
<field name="description" optional="show"/>
<field name="notes" optional="hide"/>
</list>
```
---
## Form Views
### Basic Form View
```xml
<record id="view_my_model_form" model="ir.ui.view">
<field name="name">my.model.form</field>
<field name="model">my.model</field>
<field name="arch" type="xml">
<form string="My Model">
<sheet>
<group>
<group>
<field name="name"/>
<field name="code"/>
</group>
<group>
<field name="active"/>
<field name="date"/>
</group>
</group>
<notebook>
<page string="Description">
<field name="description"/>
</page>
<page string="Notes">
<field name="notes"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
```
### Form Attributes
```xml
<form string="My Model" create="false" edit="false" delete="false">
...
</form>
```
| Attribute | Description |
| --------- | ------------------ |
| `create` | Show create button |
| `edit` | Show edit button |
| `delete` | Show delete button |
### Chatter
`<chatter/>` must be a direct sibling of `<sheet>`, not a wrapper around it:
```xml
<form string="My Model">
<sheet>
<!-- Form content -->
</sheet>
<chatter/>
</form>
```
### Statusbar
```xml
<form string="My Model">
<header>
<button name="action_confirm" string="Confirm" type="object" invisible="state != 'draft'"/>
<button name="action_done" string="Done" type="object" invisible="state != 'confirmed'"/>
<field name="state" widget="statusbar"/>
</header>
<sheet>
<!-- Form content -->
</sheet>
</form>
```
---
## Search Views
### Basic Search View
```xml
<record id="view_my_model_search" model="ir.ui.view">
<field name="name">my.model.search</field>
<field name="model">my.model</field>
<field name="arch" type="xml">
<search string="Search My Models">
<field name="name"/>
<field name="code"/>
<filter string="Active" name="active" domain="[('active','=',True)]"/>
<separator/>
<group expand="0" string="Group By">
<filter string="State" name="state" context="{'group_by': 'state'}"/>
</group>
</search>
</field>
</record>
```
### Custom Filters
```xml
<search string="Search My Models">
<field name="name"/>
<field name="partner_id"/>
<!-- Simple filter -->
<filter string="Active" name="active" domain="[('active','=',True)]"/>
<!-- Advanced filter -->
<filter string="My Partners" domain="[('partner_id.user_id', '=', uid)]"/>
<!-- Separator -->
<separator/>
<!-- Group by -->
<group expand="0" string="Group By">
<filter string="State" name="state" context="{'group_by': 'state'}"/>
<filter string="Partner" name="partner_id" context="{'group_by': 'partner_id'}"/>
</group>
</search>
```
---
## Kanban Views
### Basic Kanban View
```xml
<record id="view_my_model_kanban" model="ir.ui.view">
<field name="name">my.model.kanban</field>
<field name="model">my.model</field>
<field name="arch" type="xml">
<kanban string="My Models" default_group_by="state">
<field name="name"/>
<field name="state"/>
<templates>
<t t-name="card">
<div class="oe_kanban_card">
<div class="oe_kanban_content">
<strong><field name="name"/></strong>
<div><field name="state"/></div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
```
### Kanban with Colors
```xml
<kanban default_group_by="state" color="priority">
<field name="name"/>
<field name="priority"/>
<field name="state"/>
<templates>
<t t-name="card">
<div class="oe_kanban_card">
<div class="oe_kanban_content">
<field name="name"/>
</div>
</div>
</t>
</templates>
</kanban>
```
---
## Calendar Views
### Calendar View
```xml
<record id="view_my_model_calendar" model="ir.ui.view">
<field name="name">my.model.calendar</field>
<field name="model">my.model</field>
<field name="arch" type="xml">
<calendar string="My Calendar" date_start="date_start" date_end="date_end">
<field name="name"/>
<field name="user_id"/>
</calendar>
</field>
</record>
```
| Attribute | Description |
| ------------ | ---------------------------------------- |
| `date_start` | Start date field |
| `date_end` | End date field |
| `date_delay` | Duration field (alternative to date_end) |
| `color` | Field for color |
| `mode` | Default view (month, week, day) |
---
## Graph Views
### Graph View
```xml
<record id="view_my_model_graph" model="ir.ui.view">
<field name="name">my.model.graph</field>
<field name="model">my.model</field>
<field name="arch" type="xml">
<graph string="Sales Analysis" type="bar">
<field name="date" interval="month" type="row"/>
<field name="product_id" type="col"/>
<field name="price_total" type="measure"/>
</graph>
</field>
</record>
```
| Attribute | Description |
| --------- | -------------------- |
| `type` | `bar`, `pie`, `line` |
| `stacked` | Stack bars |
---
## Pivot Views
### Pivot View
```xml
<record id="view_my_model_pivot" model="ir.ui.view">
<field name="name">my.model.pivot</field>
<field name="model">my.model</field>
<field name="arch" type="xml">
<pivot string="Sales Analysis">
<field name="date" interval="month" type="row"/>
<field name="product_id" type="col"/>
<field name="price_total" type="measure"/>
</pivot>
</field>
</record>
```
---
## View Inheritance
### Extend View
```xml
<record id="view_my_model_form_inherit" model="ir.ui.view">
<field name="name">my.model.form.inherit</field>
<field name="model">my.model</field>
<field name="inherit_id" ref="view_my_model_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="new_field"/>
</xpath>
</field>
</record>
```
### Position Options
| Position | Description |
| ------------ | ----------------- |
| `inside` | Inside element |
| `replace` | Replace element |
| `before` | Before element |
| `after` | After element |
| `attributes` | Modify attributes |
### Example: Add Field
```xml
<xpath expr="//field[@name='name']" position="after">
<field name="new_field"/>
</xpath>
```
### Example: Replace Field
```xml
<xpath expr="//field[@name='name']" position="replace">
<field name="name" widget="char" required="1"/>
</xpath>
```
### Example: Modify Attributes
```xml
<xpath expr="//field[@name='name']" position="attributes">
<attribute name="required">True</attribute>
</xpath>
```
---
## QWeb Templates
### Basic Template
```xml
<template id="my_template" name="My Template">
<div class="my-class">
<h1>Hello World</h1>
</div>
</template>
```
### Template Inheritance
```xml
<template id="my_template_inherit" inherit_id="my_template" name="My Template Inherit">
<xpath expr="//div[@class='my-class']" position="inside">
<p>This is inherited content</p>
</xpath>
</template>
```
### QWeb Directives
| Directive | Description |
| ----------- | ----------------------------------------------- |
| `t-out` | Escape and output (replaces deprecated `t-esc`) |
| `t-field` | Output formatted field |
| `t-if` | Conditional |
| `t-elif` | Else if |
| `t-else` | Else |
| `t-foreach` | Loop |
| `t-as` | Loop variable |
| `t-set` | Set variable |
| `t-call` | Call template |
| `t-att-*` | Set attribute |
---
## References
- Odoo 19 official documentation
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 |