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
Model Definition Example 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