🛠️ Odoo Rpc API
業務システムOdooの外部連携機能(JSON
📺 まず動画で見る(YouTube)
▶ 【衝撃】最強のAIエージェント「Claude Code」の最新機能・使い方・プログラミングをAIで効率化する超実践術を解説! ↗
※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。
📜 元の英語説明(参考)
Expert on Odoo's external JSON-RPC and XML-RPC APIs. Covers authentication, model calls, record CRUD, and real-world integration examples in Python, JavaScript, and curl.
🇯🇵 日本人クリエイター向け解説
業務システムOdooの外部連携機能(JSON
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o odoo-rpc-api.zip https://jpskill.com/download/3246.zip && unzip -o odoo-rpc-api.zip && rm odoo-rpc-api.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/3246.zip -OutFile "$d\odoo-rpc-api.zip"; Expand-Archive "$d\odoo-rpc-api.zip" -DestinationPath $d -Force; ri "$d\odoo-rpc-api.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
odoo-rpc-api.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
odoo-rpc-apiフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-17
- 取得日時
- 2026-05-17
- 同梱ファイル
- 1
💬 こう話しかけるだけ — サンプルプロンプト
- › Odoo Rpc API を使って、最小構成のサンプルコードを示して
- › Odoo Rpc API の主な使い方と注意点を教えて
- › Odoo Rpc API を既存プロジェクトに組み込む方法を教えて
これをClaude Code に貼るだけで、このSkillが自動発動します。
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Odoo RPC API
概要
Odooは、JSON-RPCおよびXML-RPCを介して強力な外部APIを公開しており、あらゆる外部アプリケーションがレコードの読み取り、作成、更新、削除を行うことができます。このスキルは、認証、モデルの呼び出し、および堅牢な統合の構築についてガイドします。
このスキルを使用する場面
- 外部アプリ(例:Django、Node.js、モバイルアプリ)をOdooに接続する場合。
- Odooからデータをインポート/エクスポートする自動スクリプトを実行する場合。
- Odooとサードパーティプラットフォーム間のミドルウェア層を構築する場合。
- API認証または権限エラーをデバッグする場合。
仕組み
- アクティベート:
@odoo-rpc-apiをメンションし、必要な統合について説明してください。 - 生成: Python、JavaScript、またはcurlで、コピー&ペーストですぐに使えるRPC呼び出しコードを取得します。
- デバッグ: エラーを貼り付けると、修正された呼び出しとともに診断結果が得られます。
例
例1: 認証とレコードの読み取り (Python)
import xmlrpc.client
url = 'https://myodoo.example.com'
db = 'my_database'
username = 'admin'
password = 'my_api_key' # Use API keys, not passwords, in production
# Step 1: Authenticate
common = xmlrpc.client.ServerProxy(f'{url}/xmlrpc/2/common')
uid = common.authenticate(db, username, password, {})
print(f"Authenticated as UID: {uid}")
# Step 2: Call models
models = xmlrpc.client.ServerProxy(f'{url}/xmlrpc/2/object')
# Search confirmed sale orders
orders = models.execute_kw(db, uid, password,
'sale.order', 'search_read',
[[['state', '=', 'sale']]],
{'fields': ['name', 'partner_id', 'amount_total'], 'limit': 10}
)
for order in orders:
print(order)
例2: レコードの作成 (Python)
new_partner_id = models.execute_kw(db, uid, password,
'res.partner', 'create',
[{'name': 'Acme Corp', 'email': 'info@acme.com', 'is_company': True}]
)
print(f"Created partner ID: {new_partner_id}")
例3: curlによるJSON-RPC
curl -X POST https://myodoo.example.com/web/dataset/call_kw \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "call",
"id": 1,
"params": {
"model": "res.partner",
"method": "search_read",
"args": [[["is_company", "=", true]]],
"kwargs": {"fields": ["name", "email"], "limit": 5}
}
}'
# Note: "id" is required by the JSON-RPC 2.0 spec to correlate responses.
# Odoo 16+ also supports the /web/dataset/call_kw endpoint but
# prefer /web/dataset/call_kw for model method calls.
ベストプラクティス
- ✅ すべきこと: パスワードの代わりにAPIキー(設定 → 技術 → APIキー)を使用してください — Odoo 14以降で利用可能です。
- ✅ すべきこと: ネットワークのラウンドトリップを減らすために、
search+readの代わりにsearch_readを使用してください。 - ✅ すべきこと: 常に接続エラーを処理し、本番環境では指数関数的バックオフを伴う再試行ロジックを実装してください。
- ✅ すべきこと: 認証情報を環境変数またはシークレットマネージャー(例:AWS Secrets Manager、
.envファイル)に保存してください。 - ❌ すべきでないこと: パスワードやAPIキーをスクリプトに直接ハードコードしないでください — それらを定期的に変更し、環境変数を使用してください。
- ❌ すべきでないこと: バッチ処理せずにAPIをタイトなループで呼び出さないでください — 一括操作はサーバーの負荷を大幅に軽減します。
- ❌ すべきでないこと: API統合にマスター管理者パスワードを使用しないでください — 最小限の必要な権限を持つ専用の統合ユーザーを作成してください。
制限事項
- OAuth2またはセッションクッキーベースの認証は対象外です — 例ではAPIキー(トークン)認証のみを使用しています。
- レート制限はOdoo XMLRPCレイヤーには組み込まれていません。クライアント側でスロットリングを実装する必要があります。
- XML-RPCエンドポイント(
/xmlrpc/2/)はファイルのアップロードをサポートしていません — バイナリデータにはJSON-RPCを介したRESTベースのir.attachmentモデルを使用してください。 - Odoo.sh (SaaS) はプランによっては一部のAPI呼び出しをブロックする場合があります。サブスクリプションが外部APIアクセスをサポートしていることを確認してください。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Odoo RPC API
Overview
Odoo exposes a powerful external API via JSON-RPC and XML-RPC, allowing any external application to read, create, update, and delete records. This skill guides you through authenticating, calling models, and building robust integrations.
When to Use This Skill
- Connecting an external app (e.g., Django, Node.js, a mobile app) to Odoo.
- Running automated scripts to import/export data from Odoo.
- Building a middleware layer between Odoo and a third-party platform.
- Debugging API authentication or permission errors.
How It Works
- Activate: Mention
@odoo-rpc-apiand describe the integration you need. - Generate: Get copy-paste ready RPC call code in Python, JavaScript, or curl.
- Debug: Paste an error and get a diagnosis with a corrected call.
Examples
Example 1: Authenticate and Read Records (Python)
import xmlrpc.client
url = 'https://myodoo.example.com'
db = 'my_database'
username = 'admin'
password = 'my_api_key' # Use API keys, not passwords, in production
# Step 1: Authenticate
common = xmlrpc.client.ServerProxy(f'{url}/xmlrpc/2/common')
uid = common.authenticate(db, username, password, {})
print(f"Authenticated as UID: {uid}")
# Step 2: Call models
models = xmlrpc.client.ServerProxy(f'{url}/xmlrpc/2/object')
# Search confirmed sale orders
orders = models.execute_kw(db, uid, password,
'sale.order', 'search_read',
[[['state', '=', 'sale']]],
{'fields': ['name', 'partner_id', 'amount_total'], 'limit': 10}
)
for order in orders:
print(order)
Example 2: Create a Record (Python)
new_partner_id = models.execute_kw(db, uid, password,
'res.partner', 'create',
[{'name': 'Acme Corp', 'email': 'info@acme.com', 'is_company': True}]
)
print(f"Created partner ID: {new_partner_id}")
Example 3: JSON-RPC via curl
curl -X POST https://myodoo.example.com/web/dataset/call_kw \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "call",
"id": 1,
"params": {
"model": "res.partner",
"method": "search_read",
"args": [[["is_company", "=", true]]],
"kwargs": {"fields": ["name", "email"], "limit": 5}
}
}'
# Note: "id" is required by the JSON-RPC 2.0 spec to correlate responses.
# Odoo 16+ also supports the /web/dataset/call_kw endpoint but
# prefer /web/dataset/call_kw for model method calls.
Best Practices
- ✅ Do: Use API Keys (Settings → Technical → API Keys) instead of passwords — available from Odoo 14+.
- ✅ Do: Use
search_readinstead ofsearch+readto reduce network round trips. - ✅ Do: Always handle connection errors and implement retry logic with exponential backoff in production.
- ✅ Do: Store credentials in environment variables or a secrets manager (e.g., AWS Secrets Manager,
.envfile). - ❌ Don't: Hardcode passwords or API keys directly in scripts — rotate them and use env vars.
- ❌ Don't: Call the API in a tight loop without batching — bulk operations reduce server load significantly.
- ❌ Don't: Use the master admin password for API integrations — create a dedicated integration user with minimum required permissions.
Limitations
- Does not cover OAuth2 or session-cookie-based authentication — the examples use API key (token) auth only.
- Rate limiting is not built into the Odoo XMLRPC layer; you must implement throttling client-side.
- The XML-RPC endpoint (
/xmlrpc/2/) does not support file uploads — use the REST-basedir.attachmentmodel via JSON-RPC for binary data. - Odoo.sh (SaaS) may block some API calls depending on plan; verify your subscription supports external API access.