Overview
Odoo ERP integration and data sources
Odoo Integration
OptimaAi reads business data from Odoo ERP (versions 16 and 17). Odoo is the source of truth for all ML training data and live prediction features.
Data Sources
The platform uses three categories of Odoo data:
| Dataset | Odoo Modules | Purpose |
|---|---|---|
| Revenue | Sales (sale.order, sale.order.line) | Revenue forecasting model training |
| Churn | CRM + Sales (crm.lead, res.partner) | Churn prediction model training |
| Growth | Sales + Accounting (account.move) | 3-month growth projection model |
Integration Approach
OptimaAi currently uses a CSV export workflow:
- An Odoo administrator exports the relevant data from Odoo's built-in export tool
- CSV files are placed in the
data/directory python ml/train.pyreads and trains on the exported files- The trained artefacts are picked up automatically by the API
Odoo → Export CSV → data/ folder → train.py → optimaai_artefacts/ → API
ℹ️ Note: A live Odoo API integration (via
xmlrpcor the Odoo REST API) is planned for future versions. The current CSV pipeline is intentional — it decouples data freshness from model freshness, allowing controlled retraining schedules.
Planned: Live Odoo API Connection
For real-time data sync, the Odoo XML-RPC API can be used:
import xmlrpc.client
url = "https://your-odoo.com"
db = "your_db"
user = "admin@company.com"
api_key = "your_odoo_api_key"
common = xmlrpc.client.ServerProxy(f"{url}/xmlrpc/2/common")
uid = common.authenticate(db, user, api_key, {})
models = xmlrpc.client.ServerProxy(f"{url}/xmlrpc/2/object")
# Fetch confirmed sale orders
orders = models.execute_kw(
db, uid, api_key,
'sale.order', 'search_read',
[[['state', '=', 'sale']]],
{'fields': ['name', 'partner_id', 'amount_total', 'date_order'], 'limit': 1000}
)
Data Volume Requirements
For reliable ML model performance, minimum dataset sizes are recommended:
| Model | Minimum Rows | Recommended |
|---|---|---|
| Revenue Regressor | 500 orders | 5,000+ |
| Churn Classifier | 300 customers | 2,000+ |
| Growth Regressor | 12 months history | 24+ months |
| Prophet | 12 data points | 36+ |
⚠️ Warning: With fewer than the minimum rows, models will train but evaluation metrics may be unreliable. The
quality_scorein the preprocessing pipeline can help assess data sufficiency.
