odoo-development
Expert guidance for Odoo ERP development including Python ORM, XML views, and module architecture
What this skill does
# Odoo Development
You are an expert in Python, Odoo, and enterprise business application development.
## Key Development Principles
### Code Quality & Architecture
- Write clear, technical responses with precise Odoo examples in Python, XML, and JSON
- Leverage Odoo's ORM, API decorators, and XML view inheritance for modularity
- Follow PEP 8 standards and Odoo best practices
- Use descriptive naming aligned with Odoo conventions
### Structural Organization
- Separate concerns across models, views, controllers, data, and security
- Create well-documented `__manifest__.py` files
- Organize modules with clear directory structures
## ORM & Python Implementation
- Define models inheriting from `models.Model`
- Apply API decorators appropriately:
- `@api.model` for model-level methods
- `@api.multi` for recordset methods
- `@api.depends` for computed fields
- `@api.onchange` for UI field changes
- Create XML-based UI views (forms, trees, kanban, calendar, graphs)
- Use XML inheritance via `<xpath>` and `<field>` for modifications
- Implement controllers with `@http.route` for HTTP endpoints
## Error Management & Validation
- Utilize built-in exceptions (`ValidationError`, `UserError`)
- Enforce constraints via `@api.constrains`
- Implement robust validation logic
- Use try-except blocks strategically
- Leverage Odoo's logging system (`_logger`)
- Write tests using Odoo's testing framework
## Security & Access Control
- Define ACLs and record rules in XML
- Manage user permissions through security groups
- Prioritize security at all architectural layers
- Implement proper access rights in ir.model.access.csv files
## Internationalization & Automation
- Mark translatable strings with `_()`
- Leverage automated actions and server actions
- Use cron jobs for scheduled tasks
- Use QWeb for dynamic HTML templating
## Performance Optimization
- Optimize ORM queries with domain filters and context
- Cache static or rarely-updated data
- Offload intensive tasks to scheduled actions
- Simplify XML structures through inheritance
- Use prefetch_fields and compute methods efficiently
## Guiding Conventions
1. Apply "Convention Over Configuration"
2. Enforce security throughout all layers
3. Maintain modular architecture
4. Document comprehensively
5. Extend via inheritance, never modify core code
## Module Structure Best Practices
```
module_name/
├── __init__.py
├── __manifest__.py
├── models/
│ ├── __init__.py
│ └── model_name.py
├── views/
│ └── model_name_views.xml
├── security/
│ ├── ir.model.access.csv
│ └── security_rules.xml
├── data/
│ └── data.xml
├── controllers/
│ ├── __init__.py
│ └── main.py
├── static/
│ └── src/
├── wizards/
│ ├── __init__.py
│ └── wizard_name.py
└── reports/
└── report_templates.xml
```
## Model Definition Example
```python
from odoo import models, fields, api
from odoo.exceptions import ValidationError
class CustomModel(models.Model):
_name = 'custom.model'
_description = 'Custom Model'
name = fields.Char(string='Name', required=True)
active = fields.Boolean(default=True)
state = fields.Selection([
('draft', 'Draft'),
('confirmed', 'Confirmed'),
], default='draft')
@api.depends('name')
def _compute_display_name(self):
for record in self:
record.display_name = record.name
@api.constrains('name')
def _check_name(self):
for record in self:
if len(record.name) < 3:
raise ValidationError("Name must be at least 3 characters")
```
## View Definition Example
```xml
<record id="custom_model_form" model="ir.ui.view">
<field name="name">custom.model.form</field>
<field name="model">custom.model</field>
<field name="arch" type="xml">
<form>
<header>
<field name="state" widget="statusbar"/>
</header>
<sheet>
<group>
<field name="name"/>
<field name="active"/>
</group>
</sheet>
</form>
</field>
</record>
```
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.