This repository contains multiple example projects demonstrating integration with Odoo's JSON-RPC API to manage partner records. The projects showcase different approaches: a simple FastAPI backend, a CLI tool using Typer, and a full-featured web app with create, search, and delete functionality using FastAPI, Alpine.js, and Tailwind CSS.
A minimal FastAPI application that connects to an Odoo instance and retrieves partner records via JSON-RPC. It exposes a single endpoint /partners that returns a JSON list of partners with basic fields such as id, name, email, and image_1920.
- Demonstrates JSON-RPC calls to Odoo
- Uses environment variables for Odoo connection configuration
- Returns partner data as JSON
A command-line interface tool built with Typer that interacts with the Odoo partners data via JSON-RPC. It allows you to:
- List all partners
- Create new partners
- Delete partners by ID
This tool is useful for quick partner management from the terminal without a UI.
A more advanced web app using:
- FastAPI backend exposing RESTful endpoints for partner CRUD operations
- Alpine.js (via CDN) for frontend reactivity and API calls
- Tailwind CSS (via CDN) for styling and responsive UI
Features include:
- Display partner list with images and emails
- Search partners by name
- Create new partners (with optional base64-encoded image)
- Delete partners
This app demonstrates building a lightweight but functional full-stack application with minimal dependencies.
- Python 3.8+
- An accessible Odoo instance (with URL, DB, username, and password)
requests,fastapi,uvicorn,typer,jinja2Python packages installed (see Installation)- Internet connection for CDN scripts (Alpine.js and Tailwind CSS)
-
Clone the repository:
git clone https://github.com/django-frog/Odoo_RPC_Integration.git cd odoo-partners-integration -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # Linux/macOS venv\Scripts\activate # Windows
-
Install dependencies:
pip install -r requirements.txt
-
Create a
.envfile in the project root with your Odoo credentials:ODOO_URL=https://your-odoo-instance.com ODOO_DB=your_database ODOO_USERNAME=your_username ODOO_PASSWORD=your_password
python rpc_xml.pypython rpc_json.pyRun the CLI Typer app:
python cli_app.py [command]Commands:
list- List all partnerscreate --name NAME --email EMAIL- Create a new partnerdelete --id PARTNER_ID- Delete a partner by ID
Example:
python cli_app.py create --name "New Partner" --email "[email protected]"
python cli_app.py list
python cli_app.py delete --id 5uvicorn web_app:app --reloadOpen in your browser:
http://localhost:8000/
Features:
- View partners list with images
- Search partners by name
- Create new partner with optional base64 image input
- Delete partners
├── rpc_xml.py # Simple XML-RPC Integration returning partners
├── rpc_json.py # Simple XML-JSON Integration returning partners
├── cli_app.py # Typer CLI app for managing partners
├── web_app.py # Full FastAPI web app with CRUD
├── templates/
│ └── index.html # Jinja2 template for web app frontend
├── requirements.txt # Python dependencies
└── README.md # This file
GPL License © Mohammad Hamdan
Feel free to open issues or submit pull requests to improve the projects!
Enjoy managing your Odoo partners easily with these integration examples!