[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7146317PMNZ5KAT8MXVFRHH":3,"skill-same:01M7146317PMNZ5KAT8MXVFRHH":62},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":37,"linkOnly":38,"markdownContent":39,"markdownBody":40,"frontMatter":41,"refName":42,"commitSha":43,"skillDirectory":44,"forksCount":14,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":47,"install":48,"resources":61},"01M7146317PMNZ5KAT8MXVFRHH","odoo-orm-expert",null,"Master Odoo ORM patterns: search, browse, create, write, domain filters, computed fields, and performance-safe query techniques.","sapsapshen\u002Fai-memory-router","sapsapshen","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F20347959?v=4","01M6XDQEF1DP50DKF37H81J3J5","shenmian","01M6XDQEJPE41Y3DT2763X8ZJN",0,"MIT","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcopilot\u002Fodoo-orm-expert\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],"orm","odoo orm expert","odoo","expert","fields","safe","techniques","self","domain","query","patterns","master","filters","write","browse","search","create","performance","2026-11-10 10:12:30",false,"---\nname: odoo-orm-expert\ndescription: \"Master Odoo ORM patterns: search, browse, create, write, domain filters, computed fields, and performance-safe query techniques.\"\nrisk: safe\nsource: \"self\"\n---\n\n# Odoo ORM Expert\n\n## Overview\n\nThis skill teaches you Odoo's Object Relational Mapper (ORM) in depth. It covers reading\u002Fwriting 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`\u002F`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.\n","# Odoo ORM Expert\n\n## Overview\n\nThis skill teaches you Odoo's Object Relational Mapper (ORM) in depth. It covers reading\u002Fwriting 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`\u002F`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.\n",{"name":5,"risk":24,"source":26,"description":7},"main","7a38d8e7073e61c16eda85681cb32fb68a8657a5","skills-store\u002Fcopilot\u002Fodoo-orm-expert","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router","https:\u002F\u002Fgithub.com\u002Fsapsapshen","2026-04-14 21:12:12",{"source":8,"skillName":5,"commands":49,"prompt":59,"zipAvailable":60},[50,53,56],{"tool":51,"command":52},"npx","npx skills add sapsapshen\u002Fai-memory-router --skill odoo-orm-expert",{"tool":54,"command":55},"bunx","bunx skills add sapsapshen\u002Fai-memory-router --skill odoo-orm-expert",{"tool":57,"command":58},"pnpm","pnpm dlx skills add sapsapshen\u002Fai-memory-router --skill odoo-orm-expert","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcopilot\u002Fodoo-orm-expert\u002FSKILL.md",true,[],[63,73,80,88,94,102],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":68,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":72},"01M72R8PZX1ABFHJGTYPA4CAF1","webapp-testing","To test local web applications, write native Python Playwright scripts.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fwebapp-testing\u002FSKILL.md",[],[],"2026-11-10 22:39:42",{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":72},"01M72QG37MMZNDY7X7GXPAK5W6","python-packaging","Comprehensive guide to creating, structuring, and distributing Python packages using modern packaging tools, pyproject.toml, and publishing to PyPI.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fpython-packaging\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":84,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":72},"01M72NXR0QMP9G46TW6A2DH59C","canvas-design","These are instructions for creating design philosophies - aesthetic movements that are then EXPRESSED VISUALLY. Output only .md files, .pdf files, and .png files.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fcanvas-design\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fcanvas-design\u002FSKILL.md",[],[],{"skillNo":89,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":90,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":72},"01M72N55TK3EEQ4QK4AWDC2KZS","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":98,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":72},"01M72MTWC150CFAP4Y5GSNKF80","slack-gif-creator","A toolkit providing utilities and knowledge for creating animated GIFs optimized for Slack.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fslack-gif-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fslack-gif-creator\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":106,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":72},"01M72KPT3VVNSP88MNAY466TZT","frontend-design","You are a frontend designer-engineer, not a layout generator.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Ffrontend-design\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Ffrontend-design\u002FSKILL.md",[],[]]