Help us improve
Share bugs, ideas, or general feedback.
From antigravity-bundle-odoo-erp
Provides idiomatic Odoo ORM code for search, browse, create, write, domain filters, computed fields, and performance-safe query techniques. Use for Odoo data operations and optimization.
npx claudepluginhub sickn33/antigravity-awesome-skills --plugin antigravity-bundle-odoo-erpHow this skill is triggered — by the user, by Claude, or both
Slash command
/antigravity-bundle-odoo-erp:odoo-orm-expertThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
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.
Provides idiomatic Odoo ORM code for search, browse, create, write, domain filters, computed fields, and performance-safe query techniques. Use for Odoo data operations and optimization.
Indexes Odoo codebases for sub-100ms searches of models, fields, views, XML IDs, and modules. Validates references and traces dependencies before coding or debugging.
References Odoo 18 guides for Python models, ORM (search/domain/read_group), XML/CSV views, OWL/JS components, QWeb reports, security (ACL/rules), cron/actions, migrations, tests, i18n, performance. Activates on Odoo code/tracebacks/addons.
Share bugs, ideas, or general feedback.
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.
search(), browse(), create(), write(), or unlink() calls.@odoo-orm-expert and describe what data operation you need.# 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.
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)
# ✅ GOOD: One query for all records
partners = self.env['res.partner'].search([('country_id', '=', False)])
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
mapped(), filtered(), and sorted() on recordsets instead of Python loops.sudo() sparingly and only when you understand the security implications.search_count() over len(search(...)) when you only need a count.with_context(...) to pass context values cleanly rather than modifying self.env.context directly.search() inside a loop — this is the #1 Odoo performance killer.datetime/date objects directly into domain tuples — always stringify them as 'YYYY-MM-DD'.cr.execute() raw SQL patterns in depth — use the Odoo performance tuner skill for SQL-level optimization.models.TransientModel) or wizard patterns.