{"id":"09fd3c75-82ff-4e4c-9eca-32247800d183","shortId":"x6s4xB","kind":"skill","title":"odoo-orm-expert","tagline":"Master Odoo ORM patterns: search, browse, create, write, domain filters, computed fields, and performance-safe query techniques.","description":"# Odoo ORM Expert\n\n## Overview\n\nThis 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.\n\n## When to Use This Skill\n\n- Writing `search()`, `browse()`, `create()`, `write()`, or `unlink()` calls.\n- Building complex domain filters for views or server actions.\n- Implementing computed, stored, and related fields.\n- Debugging slow queries or optimizing bulk operations.\n\n## How It Works\n\n1. **Activate**: Mention `@odoo-orm-expert` and describe what data operation you need.\n2. **Get Code**: Receive correct, idiomatic Odoo ORM code with explanations.\n3. **Optimize**: Ask for performance review on existing ORM code.\n\n## Examples\n\n### Example 1: Search with Domain Filters\n\n```python\n# Find all confirmed sale orders for a specific customer, created this year\nimport datetime\n\nstart_of_year = datetime.date.today().replace(month=1, day=1).strftime('%Y-%m-%d')\n\norders = self.env['sale.order'].search([\n    ('partner_id', '=', partner_id),\n    ('state', '=', 'sale'),\n    ('date_order', '>=', start_of_year),\n], order='date_order desc', limit=50)\n\n# Note: pass dates as 'YYYY-MM-DD' strings in domains,\n# NOT as fields.Date objects — the ORM serializes them correctly.\n```\n\n### Example 2: Computed Field\n\n```python\ntotal_order_count = fields.Integer(\n    string='Total Orders',\n    compute='_compute_total_order_count',\n    store=True\n)\n\n@api.depends('sale_order_ids')\ndef _compute_total_order_count(self):\n    for record in self:\n        record.total_order_count = len(record.sale_order_ids)\n```\n\n### Example 3: Safe Bulk Write (avoid N+1)\n\n```python\n# ✅ GOOD: One query for all records\npartners = self.env['res.partner'].search([('country_id', '=', False)])\npartners.write({'country_id': self.env.ref('base.us').id})\n\n# ❌ BAD: Triggers a separate query per record\nfor partner in partners:\n    partner.country_id = self.env.ref('base.us').id\n```\n\n## Best Practices\n\n- ✅ **Do:** Use `mapped()`, `filtered()`, and `sorted()` on recordsets instead of Python loops.\n- ✅ **Do:** Use `sudo()` sparingly and only when you understand the security implications.\n- ✅ **Do:** Prefer `search_count()` over `len(search(...))` when you only need a count.\n- ✅ **Do:** Use `with_context(...)` to pass context values cleanly rather than modifying `self.env.context` directly.\n- ❌ **Don't:** Call `search()` inside a loop — this is the #1 Odoo performance killer.\n- ❌ **Don't:** Use raw SQL unless absolutely necessary; use ORM for all standard operations.\n- ❌ **Don't:** Pass Python `datetime`/`date` objects directly into domain tuples — always stringify them as `'YYYY-MM-DD'`.\n\n## Limitations\n\n- Does not cover **`cr.execute()` raw SQL** patterns in depth — use the Odoo performance tuner skill for SQL-level optimization.\n- **Stored computed fields** can cause significant write overhead at scale; this skill does not cover partitioning strategies.\n- Does not cover **transient models** (`models.TransientModel`) or wizard patterns.\n- ORM behavior can differ slightly between Odoo SaaS and On-Premise due to config overrides.","tags":["odoo","orm","expert","antigravity","awesome","skills","sickn33","agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding"],"capabilities":["skill","source-sickn33","skill-odoo-orm-expert","topic-agent-skills","topic-agentic-skills","topic-ai-agent-skills","topic-ai-agents","topic-ai-coding","topic-ai-workflows","topic-antigravity","topic-antigravity-skills","topic-claude-code","topic-claude-code-skills","topic-codex-cli","topic-codex-skills"],"categories":["antigravity-awesome-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/sickn33/antigravity-awesome-skills/odoo-orm-expert","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add sickn33/antigravity-awesome-skills","source_repo":"https://github.com/sickn33/antigravity-awesome-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 34666 github stars · SKILL.md body (3,175 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-23T06:51:41.357Z","embedding":null,"createdAt":"2026-04-18T21:41:49.367Z","updatedAt":"2026-04-23T06:51:41.357Z","lastSeenAt":"2026-04-23T06:51:41.357Z","tsv":"'+1':57,255 '1':97,134,160,162,355 '2':111,209 '3':122,249 '50':187 'absolut':365 'action':80 'activ':98 'alway':384 'api.depends':227 'ask':124 'avoid':51,253 'bad':276 'base.us':274,290 'behavior':440 'best':292 'brows':10,66 'build':43,72 'bulk':92,251 'call':71,347 'caus':417 'clean':339 'code':113,119,131 'common':52 'complex':73 'comput':15,82,210,220,221,232,414 'config':453 'confirm':142 'context':334,337 'correct':115,207 'count':215,224,235,243,321,330 'countri':267,271 'cover':40,395,427,432 'cr.execute':396 'creat':11,67,149 'custom':148 'd':166 'data':107 'date':177,183,190,378 'datetim':153,377 'datetime.date.today':157 'day':161 'dd':195,391 'debug':87 'def':231 'depth':38,401 'desc':185 'describ':105 'differ':442 'direct':344,380 'domain':13,44,74,137,198,382 'due':451 'exampl':132,133,208,248 'exist':129 'expert':4,25,103 'explan':121 'fals':269 'field':16,49,86,211,415 'fields.date':201 'fields.integer':216 'filter':14,45,75,138,297 'find':140 'get':112 'good':257 'id':172,174,230,247,268,272,275,288,291 'idiomat':116 'implement':81 'implic':317 'import':152 'insid':349 'instead':302 'killer':358 'len':244,323 'level':411 'like':55 'limit':186,392 'loop':305,351 'm':165 'map':296 'mapper':35 'master':5 'mention':99 'mm':194,390 'model':434 'models.transientmodel':435 'modifi':342 'month':159 'n':56,254 'necessari':366 'need':110,328 'note':188 'object':33,202,379 'odoo':2,6,23,31,101,117,356,404,445 'odoo-orm-expert':1,100 'on-premis':448 'one':258 'oper':93,108,372 'optim':91,123,412 'order':144,167,178,182,184,214,219,223,229,234,242,246 'orm':3,7,24,36,102,118,130,204,368,439 'overhead':420 'overrid':454 'overview':26 'partit':428 'partner':171,173,263,284,286 'partner.country':287 'partners.write':270 'pass':189,336,375 'pattern':8,399,438 'per':281 'perform':19,53,126,357,405 'performance-saf':18 'pitfal':54 'practic':293 'prefer':319 'premis':450 'python':139,212,256,304,376 'queri':21,58,89,259,280 'rather':340 'raw':362,397 'reading/writing':41 'receiv':114 'record':42,238,262,282 'record.sale':245 'record.total':241 'recordset':301 'relat':34,48,85 'replac':158 'res.partner':265 'review':127 'saa':446 'safe':20,250 'sale':143,176,228 'sale.order':169 'scale':422 'search':9,65,135,170,266,320,324,348 'secur':316 'self':236,240 'self.env':168,264 'self.env.context':343 'self.env.ref':273,289 'separ':279 'serial':205 'server':79 'signific':418 'skill':28,63,407,424 'skill-odoo-orm-expert' 'slight':443 'slow':88 'sort':299 'source-sickn33' 'spare':309 'specif':147 'sql':363,398,410 'sql-level':409 'standard':371 'start':154,179 'state':175 'store':83,225,413 'strategi':429 'strftime':163 'string':196,217 'stringifi':385 'sudo':308 'teach':29 'techniqu':22 'topic-agent-skills' 'topic-agentic-skills' 'topic-ai-agent-skills' 'topic-ai-agents' 'topic-ai-coding' 'topic-ai-workflows' 'topic-antigravity' 'topic-antigravity-skills' 'topic-claude-code' 'topic-claude-code-skills' 'topic-codex-cli' 'topic-codex-skills' 'total':213,218,222,233 'transient':433 'trigger':277 'true':226 'tuner':406 'tupl':383 'understand':314 'unless':364 'unlink':70 'use':61,295,307,332,361,367,402 'valu':338 'view':77 'wizard':437 'work':46,96 'write':12,64,68,252,419 'y':164 'year':151,156,181 'yyyi':193,389 'yyyy-mm-dd':192,388","prices":[{"id":"7373c984-e321-4d10-8695-dcc98b61f888","listingId":"09fd3c75-82ff-4e4c-9eca-32247800d183","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"sickn33","category":"antigravity-awesome-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T21:41:49.367Z"}],"sources":[{"listingId":"09fd3c75-82ff-4e4c-9eca-32247800d183","source":"github","sourceId":"sickn33/antigravity-awesome-skills/odoo-orm-expert","sourceUrl":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/odoo-orm-expert","isPrimary":false,"firstSeenAt":"2026-04-18T21:41:49.367Z","lastSeenAt":"2026-04-23T06:51:41.357Z"}],"details":{"listingId":"09fd3c75-82ff-4e4c-9eca-32247800d183","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"sickn33","slug":"odoo-orm-expert","github":{"repo":"sickn33/antigravity-awesome-skills","stars":34666,"topics":["agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows","antigravity","antigravity-skills","claude-code","claude-code-skills","codex-cli","codex-skills","cursor","cursor-skills","developer-tools","gemini-cli","gemini-skills","kiro","mcp","skill-library"],"license":"mit","html_url":"https://github.com/sickn33/antigravity-awesome-skills","pushed_at":"2026-04-23T06:41:03Z","description":"Installable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.","skill_md_sha":"d356676cac3c28c5edabf1f82de1a07820892db1","skill_md_path":"skills/odoo-orm-expert/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/odoo-orm-expert"},"layout":"multi","source":"github","category":"antigravity-awesome-skills","frontmatter":{"name":"odoo-orm-expert","description":"Master Odoo ORM patterns: search, browse, create, write, domain filters, computed fields, and performance-safe query techniques."},"skills_sh_url":"https://skills.sh/sickn33/antigravity-awesome-skills/odoo-orm-expert"},"updatedAt":"2026-04-23T06:51:41.357Z"}}