odoo-orm-expert
Helps your agent interact with the Odoo database. It allows searching, creating, and updating information efficiently.
What it does
This tool helps you use the Odoo ORM, which is how Odoo talks to the database. It teaches you how to search, create, modify, and delete data, as well as optimize performance.
When to use it
- ✓When you need to search or change information in Odoo.
- ✓When creating complex filters to view data.
- ✓To improve the speed of operations in Odoo.
Example of what to ask your AI
“Show me how to find all customers from Brazil who placed orders this year.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
You ask the AI by mentioning the tool's name. It provides you with the correct Odoo code and explains how it works.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add sickn33/agentic-awesome-skills --skill odoo-orm-expertOr download just the file:
curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/odoo-orm-expert/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
Odoo ORM Expert
Overview
This skill teaches you Odoo's Object Relational Mapper (ORM) in depth. It covers reading/writing records, building domain filters, working with relational fields, and avoiding common performance pitfalls like N+1 queries.
When to Use This Skill
- Writing
search(),browse(),create(),write(), orunlink()calls. - Building complex domain filters for views or server actions.
- Implementing computed, stored, and related fields.
- Debugging slow queries or optimizing bulk operations.
How It Works
- Activate: Mention
@odoo-orm-expertand describe what data operation you need. - Get Code: Receive correct, idiomatic Odoo ORM code with explanations.
- Optimize: Ask for performance review on existing ORM code.
Examples
Example 1: Search with Domain Filters
# Find all confirmed sale orders for a specific customer, created this year
import datetime
start_of_year = datetime.date.today().replace(month=1, day=1).strftime('%Y-%m-%d')
orders = self.env['sale.order'].search([
('partner_id', '=', partner_id),
('state', '=', 'sale'),
('date_order', '>=', start_of_year),
], order='date_order desc', limit=50)
# Note: pass dates as 'YYYY-MM-DD' strings in domains,
# NOT as fields.Date objects — the ORM serializes them correctly.
Example 2: Computed Field
total_order_count = fields.Integer(
string='Total Orders',
compute='_compute_total_order_count',
store=True
)
@api.depends('sale_order_ids')
def _compute_total_order_count(self):
for record in self:
record.total_order_count = len(record.sale_order_ids)
Example 3: Safe Bulk Write (avoid N+1)
# Batch writes reduce repeated calls, but can trigger additional compute/tracking queries
partners = self.env['res.partner'].browse(approved_partner_ids).exists() # Explicit scoped IDs
partners.write({'country_id': self.env.ref('base.us').id})
# ❌ BAD: Triggers a separate query per record
for partner in partners:
partner.country_id = self.env.ref('base.us').id
Best Practices
- ✅ Do: Use
mapped(),filtered(), andsorted()on recordsets instead of Python loops. - ✅ Do: Use
sudo()sparingly and only when you understand the security implications. - ✅ Do: Prefer
search_count()overlen(search(...))when you only need a count. - ✅ Do: Use
with_context(...)to pass context values cleanly rather than modifyingself.env.contextdirectly. - ❌ Don't: Call
search()inside a loop — this is the #1 Odoo performance killer. - ❌ Don't: Use raw SQL unless absolutely necessary; use ORM for all standard operations.
- ❌ Don't: Pass Python
datetime/dateobjects directly into domain tuples — always stringify them as'YYYY-MM-DD'.
Limitations
- Does not cover
cr.execute()raw SQL patterns in depth — use the Odoo performance tuner skill for SQL-level optimization. - Stored computed fields can cause significant write overhead at scale; this skill does not cover partitioning strategies.
- Does not cover transient models (
models.TransientModel) or wizard patterns. - ORM behavior can differ slightly between Odoo SaaS and On-Premise due to config overrides.
Examples are model-method fragments requiring imports, record definitions and authorized scope. Do not infer missing country data means US; write only confirmed values to selected records. sudo() bypasses access rules and requires a justified boundary. Batch operations do not guarantee one SQL query, and mapped/filtered may load large recordsets; profile actual query counts and test record-rule/multi-company isolation.
FAQ
What is Odoo ORM?
It's the way Odoo organizes and accesses data in the database, like a translator between what you ask for and what the database understands.
What are 'domain filters'?
They are rules you set to filter the data you want to see, like 'show only active customers'.
Why optimize performance?
To make Odoo run faster, especially when you have a lot of data or many users.
Details
Original description by the author
Master Odoo ORM patterns: search, browse, create, write, domain filters, computed fields, and performance-safe query techniques.
Popularity
- GitHub stars
- 48k
- Ranking position
- #3731
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
00-andruia-consultant
Helps your agent start or improve AI projects. It analyzes code, suggests tools, and creates action plans in Spanish.
sickn33/agentic-awesome-skills
007
Lets your agent perform security audits and threat modeling. It's useful for protecting projects against attacks and vulnerabilities.
sickn33/agentic-awesome-skills
10-andruia-skill-smith
Helps your agent create or improve AI tools. It defines how tools work, writes documentation, and validates the structure.
sickn33/agentic-awesome-skills
20-andruia-niche-intelligence
Lets your agent create a summary about a specific industry. It's useful for understanding the context, rules, usage patterns, and risks of a project, using reliable sources.
sickn33/agentic-awesome-skills
Similar skills
api-connector-builder
Has your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
affaan-m/ECC
api-design
Helps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
affaan-m/ECC
backend-patterns
Helps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.
affaan-m/ECC