Creating Models
Step-by-step guide to create a new Odoo model with fields, constraints, and methods.
Best use case
Creating Models is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Step-by-step guide to create a new Odoo model with fields, constraints, and methods.
Teams using Creating Models should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/creating-models/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How Creating Models Compares
| Feature / Agent | Creating Models | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Step-by-step guide to create a new Odoo model with fields, constraints, and methods.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Creating Odoo Models
## Steps
1. **Create the Python file** in `models/` directory (e.g. `models/my_model.py`).
2. **Define the model class**:
```python
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
class MyModel(models.Model):
_name = 'my.model'
_description = 'My Model'
_order = 'sequence, name'
name = fields.Char(string='Name', required=True)
sequence = fields.Integer(default=10)
active = fields.Boolean(default=True)
state = fields.Selection([
('draft', 'Draft'),
('confirmed', 'Confirmed'),
('done', 'Done'),
], default='draft', string='Status', tracking=True)
partner_id = fields.Many2one('res.partner', string='Partner')
line_ids = fields.One2many('my.model.line', 'model_id', string='Lines')
tag_ids = fields.Many2many('my.model.tag', string='Tags')
total = fields.Float(compute='_compute_total', store=True)
@api.depends('line_ids.amount')
def _compute_total(self):
for record in self:
record.total = sum(record.line_ids.mapped('amount'))
@api.constrains('name')
def _check_name(self):
for record in self:
if record.name and len(record.name) < 3:
raise ValidationError(_("Name must be at least 3 characters."))
def action_confirm(self):
self.write({'state': 'confirmed'})
```
3. **Register in `__init__.py`**: Add `from . import my_model` in `models/__init__.py`.
4. **Add to manifest**: Ensure `models/` is imported in the module's root `__init__.py`.
5. **Add security**: Create ACL in `security/ir.model.access.csv`.
6. **Create views**: Add form and list views in `views/my_model_views.xml`.
## Checklist
- [ ] `_name` and `_description` set
- [ ] Fields defined with proper types and attributes
- [ ] Computed fields have `@api.depends`
- [ ] Constraints use `@api.constrains`
- [ ] Model registered in `__init__.py` chain
- [ ] ACL entry in `ir.model.access.csv`
- [ ] Views created (at minimum form + list)
- [ ] Added to `__manifest__.py` data listRelated Skills
ios-foundation-models
Use when implementing on-device AI with Apple's Foundation Models framework — prevents context overflow, blocking UI, wrong model use cases, and manual JSON parsing when @Generable should be used. iOS 26+, macOS 26+, iPadOS 26+, ios-visionOS 26+
Apple Foundation Models
Use this skill when working with Apple's Foundation Models framework for on-device AI and LLM capabilities in iOS/macOS apps
analyzing-business-models
Analyzes business models including revenue models, unit economics, competitive moats, scalability, and value creation/capture mechanisms using frameworks like Business Model Canvas and strategic analysis. Use when the user requests business model analysis, unit economics review, moat assessment, or wants to understand how a company creates and captures value.
Creating Cursor Rules
Expert guidance for creating effective Cursor IDE rules with best practices, patterns, and examples
sqlmodel-task-models
This skill should be used when defining a robust, type-safe, and async-compatible database schema for the Todo application using SQLModel, ensuring compatibility with Better Auth and optimized for PostgreSQL.
defining-typescript-models
Defines standard TypeScript interfaces for Appwrite Collections. Use when creating new models for Tours, Users, or Bookings to ensure full type safety.
creating-skills
Use when creating new Claude Code skills or improving existing ones - ensures skills are discoverable, scannable, and effective through proper structure, CSO optimization, and real examples
creating-cursor-rules-skill
Expert guidance for creating effective Cursor IDE rules with best practices, patterns, and examples
creating-continue-packages
Use when creating Continue rules - provides required name field, alwaysApply semantics, glob/regex patterns, and markdown format with optional frontmatter
creating-chatgpt-widgets
Create production-grade widgets for ChatGPT Apps using the OpenAI Apps SDK. Use when users ask to build widgets, UI components, or visual interfaces for ChatGPT applications. Supports any widget type including progress trackers, quiz interfaces, content viewers, data cards, carousels, forms, charts, dashboards, maps, video players, or custom interactive elements. IMPORTANT - Always clarify requirements before building. Creates complete implementations following official OpenAI UX/UI guidelines with window.openai integration, theme support, and accessibility.
creating-bookmarklets
Creates browser-executable JavaScript bookmarklets with strict formatting requirements. Use when users mention bookmarklets, browser utilities, dragging code to bookmarks bar, or need JavaScript that runs when clicked in the browser toolbar.
update-google-agent-models
Fast-path Google/Gemini-only agent chain update. Use when user says "Update Gemini Agent Models", "Update Gemnini Agent Models", or "Update Google Agent Models".