Welcome to OdooConnectorAPI
Relevant source files
The following files were used as context for generating this wiki page:
OdooConnectorAPI is a RESTful API service designed to bridge external applications with the Odoo ERP system. Built using the FastAPI framework, it provides an asynchronous interface to interact with Odoo data through the odoorpc library. The project is structured to support containerized workflows using Docker and orchestrated deployments via Kubernetes Helm charts.
Sources: README.md:3-8, app/main.py:1-7, requirements.txt:1-7
System Architecture
The architecture consists of the FastAPI application acting as a gateway that connects to an Odoo backend. The Odoo backend typically requires a PostgreSQL database to function. The API interacts with Odoo using the RPC protocol to perform search and read operations on Odoo models.
The diagram above illustrates the request flow from an external client through the FastAPI gateway to the Odoo ERP system.
Sources: app/main.py:20-30, odoo/docker-compose.yml:3-50
Component Overview
The system is divided into several deployment and configuration components:
| Component | Description | Technologies |
|---|---|---|
| API Gateway | RESTful interface for external communication | FastAPI, Uvicorn |
| Connector | Library for Odoo communication | odoorpc |
| Containerization | Environment isolation and deployment | Docker, Docker Compose |
| Orchestration | Scalable production deployment | Kubernetes, Helm |
Sources: README.md:1-10, requirements.txt:1-7, charts/odooconnectorapi/Chart.yaml:1-4
API Endpoints
The API exposes endpoints to interact with Odoo resources. Currently, it implements basic health checks and partner data retrieval.
Endpoint Specifications
- Root Endpoint (
/): Returns a basic JSON greeting. - Get Partners (
/get/partners): Connects to Odoo, authenticates, and retrieves a list of partners including their names and emails.
This sequence shows the lifecycle of a partner data request, including the mandatory login/logout cycle required by odoorpc.
Sources: app/main.py:16-37
Configuration and Environment
The application relies heavily on environment variables for database connectivity and credentials. These can be set via a .env file for local development, defined in docker-compose.yml, or injected through Kubernetes values.yaml.
Configuration Variables
| Variable | Description | Default Value |
|---|---|---|
ODOO_URL | The hostname/address of the Odoo server | localhost |
ODOO_DB | The name of the Odoo database to connect to | mydb |
ODOO_USERNAME | The administrative username for Odoo | admin |
ODOO_PASSWORD | The administrative password for Odoo | admin |
Sources: app/main.py:10-13, docker-compose.yml:10-14, charts/odooconnectorapi/values.yaml:13-17
Implementation Example (FastAPI Configuration)
# app/main.py:10-13
ODOO_URL = os.getenv('ODOO_URL', 'localhost')
ODOO_DB = os.getenv('ODOO_DB', 'mydb')
ODOO_USERNAME = os.getenv('ODOO_USERNAME', 'admin')
ODOO_PASSWORD = os.getenv('ODOO_PASSWORD', 'admin')
Sources: app/main.py:10-13
Deployment Infrastructure
The project provides multiple methods for deployment, ranging from local development to production-ready Kubernetes environments.
Docker and Docker Compose
A local environment can be spun up using Docker Compose, which builds the API image and sets up the necessary networking to communicate with Odoo services.
# docker-compose.yml:4-14
services:
web:
build: .
command: uvicorn app.main:app --host 0.0.0.0 --reload
ports:
- "8000:8000"
environment:
ODOO_URL: ${ODOO_URL}
ODOO_DB: ${ODOO_DB}
ODOO_USERNAME: ${ODOO_USERNAME}
ODOO_PASSWORD: ${ODOO_PASSWORD}
Sources: docker-compose.yml:4-14
Kubernetes Helm Chart
For scalable environments, a Helm chart is provided in charts/odooconnectorapi. It defines:
- Deployment: Manages pod replicas and environment variable injection.
- Service: Exposes the API (default
ClusterIPon port 80).
Sources: charts/odooconnectorapi/templates/deployment.yaml:1-24, charts/odooconnectorapi/templates/service.yaml:1-12
Security Policy
The project maintains a security policy focusing on supported versions and vulnerability reporting.
- Supported Versions: Security updates are currently provided for version
1.0.x. Versions< 1.0are not supported. - Reporting: Vulnerabilities should be reported via email to
security@datacosmos-br.org. - Disclosure: The project follows a responsible disclosure policy, asking reporters to wait for a fix before publicizing issues.
Sources: SECURITY.md:5-12, SECURITY.md:16-20
Conclusion
OdooConnectorAPI serves as a standardized bridge for Odoo integrations, abstracting the complexities of RPC communication into a modern FastAPI interface. By providing comprehensive Docker and Helm configurations, it ensures portability across development and production stages while maintaining a clear security protocol for enterprise readiness.