Skip to main content

odoo-api-integration

Odoo 18 external API integration — JSON-RPC, controllers, FastAPI patterns

소스 정보

저장소
Insightpulseai/odoo
최근 소스 활동
2026년 4월 9일 11:24
감지된 SKILL.md 언어
영어
스타
6
포크
2

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
odoo_api_integration
description
Odoo 18 external API integration — JSON-RPC, controllers, FastAPI patterns
category
integration
priority
high
version
1.0
# API Integration ## JSON-RPC (Primary External API) Endpoint: /jsonrpc ```python import json, urllib.request def rpc(url, service, method, *args): payload = json.dumps({ "jsonrpc": "2.0", "method": "call", "id": 1, "params": {"service": service, "method": method, "args": list(args)} }).encode() req = urllib.request.Request(url, payload, {"Content-Type": "application/json"}) return json.loads(urllib.request.urlopen(req).read())["result"] ``` ## Authentication ```python uid = rpc(url, "common", "authenticate", db, user, password, {}) ``` ## CRUD via execute_kw ```python rpc(url, "object", "execute_kw", db, uid, pwd, model, method, args, kwargs) # Methods: search, search_read, read, create, write, unlink, search_count ``` ## HTTP Controllers ```python from odoo import http class MyController(http.Controller): @http.route('/my/endpoint', type='json', auth='user', methods=['POST']) def my_endpoint(self, **kw): return {'status': 'ok'} ``` - Controller file: name after module (my_module.py), NOT main.py - type='json' for JSON-RPC, type='http' for standard HTTP - auth='user' (logged in), 'public' (anyone), 'none' (no session) ## OCA FastAPI (Recommended for Agent APIs) - Module: fastapi from OCA/rest-framework - Pydantic type safety, OpenAPI auto-docs - Native Odoo ORM access in routes - Preferred over custom controllers for AI agent communication ## Context Flags (Suppress Side Effects) ```python context = { 'no_reset_password': True, # No email invite 'mail_create_nosubscribe': True, # No follower subscription 'mail_notrack': True, # No tracking messages 'tracking_disable': True, # No field tracking } ``` ## Odoo 18 API Notes - Field: group_ids (not groups_id) on res.users - Portal/Internal User are exclusive groups — cannot assign both - Command tuples for relational writes: (4, id) add, (3, id) remove, (6, 0, [ids]) replace
GitHub에서 보기