{"skill":{"slug":"odoo-json2-operator","displayName":"Odoo JSON2 Operator","summary":"Execute Odoo operations through JSON-2 API endpoints with bearer API keys. Use when the user asks to query or mutate Odoo data (search, read, create, write,...","description":"---\nname: odoo-json2-operator\ndescription: Execute Odoo operations through JSON-2 API endpoints with bearer API keys. Use when the user asks to query or mutate Odoo data (search, read, create, write, unlink, or custom model methods), validate model/method signatures from the api_doc module, or automate step-by-step business actions against an Odoo instance.\n---\n\n# Odoo JSON-2 Operator\n\nUse this skill to execute Odoo model methods safely via HTTP API.\n\n## Use bundled resources\n- Read `references/odoo-api-doc-module.md` for route map and payload conventions based on the local `api_doc` module.\n- Read `references/api-doc-static-src-learning.md` for model discovery/search/method payload behavior extracted from `api_doc/static/src`.\n- Read `references/analysis-playbook.md` when user asks for summary analysis, management report, trend interpretation, or decision advice.\n- Use `scripts/odoo_json2_client.py` to perform deterministic discovery and API calls.\n\n## Workflow\n1. Collect required connection inputs first: `base_url`, `database`, `api_key`.\n2. Parse user natural-language request into operation intent:\n   - Infer target business object and map it to likely Odoo model.\n   - Infer operation type (query/read/create/update/delete/custom action/data analysis).\n3. Discover and validate the target method:\n   - Call `/doc-bearer/index.json` to confirm the model exists.\n   - Call `/doc-bearer/<model>.json` to confirm method name and parameter hints.\n4. Build a minimal payload:\n   - Read operations first (`search`, `search_read`, `read`) to verify scope.\n   - For mutating operations, include only required and changed fields.\n5. Execute API call using script:\n   - Endpoint: `/json/2/<model>/<method>`\n   - Method: `POST`\n   - Headers: bearer token, JSON content type, `X-Odoo-Database`.\n   - Store temporary payload files only under `skills/odoo-json2-operator/.tmp/`.\n   - If `--payload-file` points to a `tmp_*.json` file (or any JSON under `--tmp-dir`), the client auto-deletes it after execution.\n   - To keep temp payloads for debugging, pass `--keep-tmp-payload-file`.\n6. Parse and report result:\n   - If success, summarize key business outcome.\n   - If failure, include HTTP status, `message`, and `debug` details when present.\n7. If user asks for analysis/report:\n   - Aggregate and compare data by period/segment.\n   - Produce professional interpretation and decision recommendations in plain Chinese.\n\n## Conversation protocol\n- Persist successful connections locally as named profiles containing `base_url`, `database`, and `api_key`.\n- Reuse saved profile by default in later turns; do not repeatedly ask for credentials.\n- If multiple profiles exist and user does not specify a target system at session start, ask which system/profile to use before proceeding.\n- Ask for `base_url`, `database`, and `api_key` only when no usable profile exists or when user wants a new/updated system.\n- Accept free-form user text and convert it to `model`, `method`, and payload draft.\n- Discover models and methods from `/doc-bearer/index.json` before choosing targets.\n- Use normalized matching for intent mapping (lowercase + strip punctuation) and prioritize exact model/method hits.\n- Validate chosen model with `/doc-bearer/<model>.json` and align payload keys to documented parameters.\n- If required parameters are missing, ask in plain language and provide concrete examples.\n- Explain parameters in business terms, not internal API jargon.\n- Confirm assumptions when model mapping is ambiguous.\n\n## Analysis output standard\nWhen the task is analysis/reporting, answer with this structure:\n- `结论摘要`: 1-3 lines, direct answer first.\n- `关键发现`: data-backed findings with core numbers.\n- `风险与机会`: what may worsen and where upside exists.\n- `决策建议`: 3-5 prioritized actions with expected impact and effort.\n- `下一步`: missing data to improve confidence and follow-up checks.\n\nUse plain Chinese, avoid dense jargon, and clearly separate facts vs assumptions.\n\n## Missing-parameter guidance style\nUse short, clear prompts like:\n- \"我已经知道你要更新客户了，但还差客户ID。请给我一个或多个客户ID，例如 `[45]`。\"\n- \"你要创建销售订单，还缺必填字段 `partner_id`（客户）和 `order_line`（订单行）。你可以告诉我客户是谁、商品和数量，我来帮你组装。\"\n- \"当前只差连接信息：请发我 `base_url`、`database`、`API Key`，我就可以开始执行。\"\n- \"要做经营分析还缺时间范围。请告诉我你要看最近7天、30天，还是本月/上月。\"\n\n## Command templates\n```bash\npython skills/odoo-json2-operator/scripts/odoo_json2_client.py \\\n  --save-profile \"odoo-prod\" \\\n  --base-url \"https://odoo.example.com\" \\\n  --database \"mydb\" \\\n  --api-key \"$ODOO_API_KEY\"\n```\n\n```bash\npython skills/odoo-json2-operator/scripts/odoo_json2_client.py --list-profiles\n```\n\n```bash\npython skills/odoo-json2-operator/scripts/odoo_json2_client.py \\\n  --profile \"odoo-prod\" \\\n  --discover-index\n```\n\n```bash\npython skills/odoo-json2-operator/scripts/odoo_json2_client.py \\\n  --profile \"odoo-prod\" \\\n  --discover-model \"res.partner\"\n```\n\n```bash\npython skills/odoo-json2-operator/scripts/odoo_json2_client.py \\\n  --profile \"odoo-prod\" \\\n  --model \"res.partner\" \\\n  --method \"search_read\" \\\n  --payload '{\"domain\": [[\"name\", \"ilike\", \"Acme\"]], \"fields\": [\"name\", \"email\"], \"limit\": 20}'\n```\n\n```bash\npython skills/odoo-json2-operator/scripts/odoo_json2_client.py \\\n  --profile \"odoo-prod\" \\\n  --tmp-dir \"skills/odoo-json2-operator/.tmp\" \\\n  --model \"res.partner\" \\\n  --method \"search_read\" \\\n  --payload-file \"skills/odoo-json2-operator/.tmp/tmp_partner_search.json\"\n```\n\n## Guardrails\n- Never guess model/method names when discovery endpoints are available.\n- Never run destructive mutations without first showing the matching records unless user explicitly asks to skip preview.\n- Never log or persist API keys in files, command history snippets, or chat output.\n- Prefer idempotent operations where possible.\n","topics":["Business","Json"],"tags":{"latest":"2026.2.18"},"stats":{"comments":0,"downloads":363,"installsAllTime":14,"installsCurrent":0,"stars":0,"versions":1},"createdAt":1771424886291,"updatedAt":1779077064332},"latestVersion":{"version":"2026.2.18","createdAt":1771424886291,"changelog":"Publish from Gavin workspace","license":null},"metadata":null,"owner":{"handle":"sncic","userId":"s1778h3ecqcfhccwqjw2npn86h885s2h","displayName":"SNCIC","image":"https://avatars.githubusercontent.com/u/105479014?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1779921992080}}