Overview
Icon for Odoo

Odoo

Two-way Odoo ERP sync

Copy to clipboard@vicacha-devs/medusa-plugin-odoo

The Complete Bidirectional Odoo ERP (Odoo 14–19+ JSON-RPC 2.0 & JSON-2 API) Integration, Multi-Warehouse Inventory Drift Reconciliation, Automated Order/Invoice/Payment Accounting, POS Barcode Resolver & Offline POS Replay Suite for Medusa v2 (Copy to clipboard^2.21.0).

Copy to clipboardmedusa-plugin-odoo unifies and supersedes two separate Medusa ecosystem packages—Copy to clipboard@bambiste/medusa-odoo and Copy to clipboard@techmarbles/medusa-odoo-connector—into a single self-contained, zero-external-SaaS-proxy Medusa v2 plugin with native support for both legacy Odoo 14–18 JSON-RPC 2.0 and modern Odoo 19+ JSON-2 REST/RPC APIs.

Table of Contents

  1. Overview & Ecosystem Comparison
  2. Architecture Overview
  3. Installation & Copy to clipboardmedusa-config.ts Configuration
  4. Bidirectional Sync Capabilities
  5. Database Schema (Copy to clipboardmpo_* Models)
  6. Medusa v2 Workflows & Compensation
  7. Subscribers & Scheduled Jobs
  8. Complete REST API Reference
  9. Typed SDK (Copy to clipboardmedusa-plugin-odoo/sdk) & React Hooks (Copy to clipboardmedusa-plugin-odoo/hooks)
  10. Decoupled Admin UI, Widgets & 10-Locale i18n
  11. Security Architecture
  12. Development & Testing Commands

1. Overview & Ecosystem Comparison

Feature / Capability Copy to clipboard@bambiste/medusa-odoo Copy to clipboard@techmarbles/medusa-odoo-connector Copy to clipboard@vicacha-devs/medusa-plugin-odoo Medusa Version v2 (Copy to clipboard^2.x) v2 (Copy to clipboard^2.x) v2 (Copy to clipboard^2.21.0) External SaaS Proxy Required No Yes (Requires external connector proxy) No (100% self-hosted inside Medusa) Odoo Protocol Support JSON-RPC 2.0 only Proxy-dependent Dual Protocol: JSON-RPC 2.0 (Odoo 14–18) & JSON-2 API (Odoo 19+) Resilience & Rate Limiting Basic Copy to clipboardfetch Proxy-dependent Token-Bucket Rate Limiter, Circuit Breaker (Copy to clipboardclosed/Copy to clipboardopen/Copy to clipboardhalf-open) & Exponential Backoff Product & Variant Sync One-way import Basic catalog sync Bidirectional (Copy to clipboardodoo_to_medusa, Copy to clipboardmedusa_to_odoo, Copy to clipboardbidirectional) + non-destructive variant reconciliation Multi-Warehouse Inventory Single stock location Basic stock sync Multi-Warehouse Copy to clipboardstock_location ↔ Copy to clipboardstock.warehouse (Copy to clipboardlot_stock_id), Copy to clipboardon_hand & Copy to clipboardforecasted modes Inventory Drift Reconciliation None None Automated & manual drift detection (Copy to clipboardodoo_wins, Copy to clipboardmedusa_wins, Copy to clipboardmanual_conflict) + point-in-time snapshots Orders, Invoices & Payments Basic Copy to clipboardsale.order Basic Copy to clipboardsale.order Idempotent Copy to clipboardsale.order + Copy to clipboardaccount.move invoice creation/posting (Copy to clipboardall, Copy to clipboardpaid, Copy to clipboardfulfilled) + Copy to clipboardaccount.payment.register Two-Way Customer Sync Order partner only Order partner only Two-way Copy to clipboardres.partner ↔ Medusa Customer sync with B2B Company/VAT & addresses POS Barcode Resolver & Offline Replay None None Sub-10ms Copy to clipboard/store/odoo/barcode resolver (Copy to clipboardpos, Copy to clipboardwarehouse, Copy to clipboardreceiving, Copy to clipboardstocktake) + Offline POS transaction queue Inbound Webhooks & Observability None Basic webhook Timing-safe HMAC-SHA256 Copy to clipboard/hooks/odoo with event deduplication + OpenMetrics/Prometheus Copy to clipboard/admin/odoo/metrics Admin UI & i18n Minimal page Settings form 5-Route Admin Control Center (Copy to clipboard/app/odoo/*), Order & Product Widgets, 18 modular components (Copy to clipboard< 170 lines), 10 locales

2. Architecture Overview

graph TD
subgraph "Admin UI, Widgets & Storefront / POS Clients"
AdminRoutes["5 Admin Routes (/app/odoo, /connection, /settings, /logs, /barcode)"]
Widgets["Order & Product Widgets (order.details.after, product.details.after)"]
PosClient["Storefront & POS Scanner (/store/odoo/barcode)"]
Hooks["React Hooks (medusa-plugin-odoo/hooks)"]
SDK["Typed SDK Client (medusa-plugin-odoo/sdk)"]
end
subgraph "Medusa v2 API Layer (src/api)"
AdminAPI["14 Admin Endpoints (/admin/odoo/*)"]
StoreAPI["Store Barcode Endpoint (/store/odoo/barcode)"]
WebhookAPI["Inbound Webhook Receiver (/hooks/odoo)"]
Middlewares["Zod Validators & preserveRawBody Middleware"]
end
subgraph "Workflows, Subscribers & Scheduled Jobs"
WF["Medusa v2 Workflows (Products, Inventory, Orders, Customers, Reconciliation, POS Replay, Barcode, Webhooks)"]
Subs["4 Event Subscribers (order.placed, product.*, inventory-level.updated, customer.*)"]
Jobs["2 Cron Jobs (odoo-scheduled-sync, odoo-reconciliation)"]

Core Architectural Layers

  1. Multi-Protocol Copy to clipboardOdooClient (Copy to clipboardsrc/modules/odoo/client/odoo-client.ts):
    • JSON-RPC 2.0 (Copy to clipboardprotocol: "jsonrpc"): Authenticates via Copy to clipboard/jsonrpc (Copy to clipboardservice: "common", Copy to clipboardmethod: "authenticate") and executes model methods via Copy to clipboardservice: "object", Copy to clipboardmethod: "execute_kw" for Odoo 14, 15, 16, 17, and 18.
    • Odoo 19+ JSON-2 API (Copy to clipboardprotocol: "json2"): Executes RESTful RPC calls against Copy to clipboard/json/2/{model}/{method} using Copy to clipboardAuthorization: Bearer <apiKey> and optional Copy to clipboardX-Odoo-Database: <db>.
    • Resilience Primitives: Built-in token-bucket rate limiter (Copy to clipboardrateLimitPerSec), 3-state circuit breaker (Copy to clipboardclosed → Copy to clipboardopen → Copy to clipboardhalf-open), and exponential backoff retry loop (Copy to clipboardmaxRetries).
  2. Copy to clipboardOdooModuleService (Copy to clipboardsrc/modules/odoo/service.ts):
    • Extends Copy to clipboardMedusaService(OdooModels) with full lifecycle management for connection settings, section configurations, bidirectional entity synchronization, drift reconciliation, barcode resolution, offline POS replay, and webhook processing.
  3. 10 DML Models with Copy to clipboardmpo_ Prefix (Copy to clipboardsrc/modules/odoo/models/index.ts):
    • Stores all ERP state in isolated PostgreSQL tables (Copy to clipboardmpo_setting, Copy to clipboardmpo_erp_mapping, Copy to clipboardmpo_sync_log, Copy to clipboardmpo_sync_failure, Copy to clipboardmpo_inventory_snapshot, Copy to clipboardmpo_reconciliation_log, Copy to clipboardmpo_conflict_resolution, Copy to clipboardmpo_barcode_scan_log, Copy to clipboardmpo_offline_pos_transaction, Copy to clipboardmpo_webhook_event).
  4. Compatibility Alias (Copy to clipboardsrc/modules/odoo-sync/index.ts):
    • Exposes Copy to clipboardmedusa-plugin-odoo/modules/odoo-sync as a drop-in compatibility alias for projects migrating from Copy to clipboard@bambiste/medusa-odoo.

3. Installation & Copy to clipboardmedusa-config.ts Configuration

Step 1: Install the Package

pnpm add @vicacha-devs/medusa-plugin-odoo
# or
npm install @vicacha-devs/medusa-plugin-odoo

Step 2: Configure Copy to clipboardmedusa-config.ts

Register the plugin in Copy to clipboardplugins and the module in Copy to clipboardmodules (using either Copy to clipboardmedusa-plugin-odoo/modules/odoo or the compatibility alias Copy to clipboardmedusa-plugin-odoo/modules/odoo-sync):

import { defineConfig } from "@medusajs/framework/utils"
export default defineConfig({
projectConfig: {
databaseUrl: process.env.DATABASE_URL,
},
plugins: [
{
resolve: "@vicacha-devs/medusa-plugin-odoo",
options: {
url: process.env.ODOO_URL,
db: process.env.ODOO_DB,
username: process.env.ODOO_USERNAME,
apiKey: process.env.ODOO_API_KEY,
password: process.env.ODOO_PASSWORD,
protocol: "jsonrpc", // "jsonrpc" (Odoo 14–18) or "json2" (Odoo 19+)
companyId: 1,
timeoutMs: 30000,
maxRetries: 3,
rateLimitPerSec: 20,

Step 3: Run Database Migrations

npx medusa db:migrate

4. Bidirectional Sync Capabilities

4.1 Products & Variants (Copy to clipboardproduct.template ↔ Copy to clipboardproduct & Copy to clipboardproduct.product ↔ Copy to clipboardvariant)

  • Odoo → Medusa Import: Fetches Copy to clipboardproduct.template and Copy to clipboardproduct.product records, maps attributes to Medusa options/variants, converts Copy to clipboardimage_1920 base64 images into data URLs or file attachments, deduplicates product handles via Copy to clipboardslugifyHandle, and performs non-destructive variant reconciliation (matching existing variants by Copy to clipboardErpMapping, Copy to clipboardsku, or Copy to clipboardbarcode without destroying historical IDs).
  • Medusa → Odoo Export: Pushes Medusa products and variants to Odoo Copy to clipboardproduct.template / Copy to clipboardproduct.product, computes SHA-256 payload checksums (Copy to clipboardcomputeExternalChecksum), and updates Copy to clipboardmpo_erp_mapping to prevent circular subscriber loops.

4.2 Multi-Warehouse Inventory & Drift Reconciliation (Copy to clipboardstock.quant / Copy to clipboardstock.warehouse)

  • Location Mapping: Maps Medusa Copy to clipboardstock_location IDs to Odoo Copy to clipboardstock.warehouse (Copy to clipboardlot_stock_id) records.
  • Quantity Modes: Supports both On-Hand (Copy to clipboardquantity / Copy to clipboardqty_available) and Forecasted (Copy to clipboardvirtual_available) inventory quantities.
  • Automated Drift Reconciliation: Compares Medusa inventory levels against Odoo stock quants across all mapped variants and warehouses, recording point-in-time Copy to clipboardmpo_inventory_snapshot rows and resolving discrepancies using:
    • Copy to clipboardodoo_wins: Automatically updates Medusa inventory levels to match Odoo.
    • Copy to clipboardmedusa_wins: Automatically writes Odoo Copy to clipboardstock.quant inventory adjustments to match Medusa.
    • Copy to clipboardmanual_conflict: Opens an Copy to clipboardmpo_conflict_resolution record for human review in Copy to clipboard/app/odoo/logs.

4.3 Orders, Invoices & Payments (Copy to clipboardsale.order, Copy to clipboardaccount.move, Copy to clipboardaccount.payment.register)

  • Order Sync: Triggered automatically on Copy to clipboardorder.placed or manually from the Order widget / API. Resolves or creates the customer Copy to clipboardres.partner, maps line items by SKU/ERP mapping, creates Copy to clipboardsale.order + Copy to clipboardsale.order.line, and optionally confirms the quotation (Copy to clipboardaction_confirm).
  • Invoicing & Payment Registration: When Copy to clipboardexportInvoice is enabled and the order satisfies Copy to clipboardinvoiceMode (Copy to clipboardall, Copy to clipboardpaid, or Copy to clipboardfulfilled), creates and posts the Odoo invoice (Copy to clipboardaccount.move / Copy to clipboardaction_post) and optionally registers payment via Copy to clipboardaccount.payment.register against the configured Copy to clipboardpaymentJournalId.

4.4 Customers (Copy to clipboardres.partner)

  • Two-Way Partner Sync: Matches Medusa customers and Odoo Copy to clipboardres.partner records via Copy to clipboardmpo_erp_mapping and normalized email addresses, syncing names, phone numbers, street/city/zip/country addresses, and B2B company/VAT fields.

4.5 POS & Warehouse Barcode Resolver + Offline POS Replay

  • Sub-10ms Barcode Lookup (Copy to clipboardPOST /store/odoo/barcode): Resolves Copy to clipboardbarcode, Copy to clipboardEAN-13, Copy to clipboardUPC, or Copy to clipboardSKU across four operational contexts (Copy to clipboardpos, Copy to clipboardwarehouse, Copy to clipboardreceiving, Copy to clipboardstocktake) using an in-memory TTL cache → Copy to clipboardmpo_erp_mapping → Medusa database → live Odoo RPC fallback, logging every scan to Copy to clipboardmpo_barcode_scan_log.
  • Offline POS Transaction Queue (Copy to clipboardmpo_offline_pos_transaction): Enqueues offline POS checkouts with idempotent Copy to clipboardexternal_transaction_id deduplication and replays them into Medusa orders and Odoo Copy to clipboardsale.order records once connectivity is restored.

4.6 Inbound Webhooks (Copy to clipboard/hooks/odoo) & Prometheus Metrics (Copy to clipboard/admin/odoo/metrics)

  • Inbound Webhooks: Verifies Copy to clipboardx-odoo-signature / Copy to clipboardx-webhook-signature against the raw request body using Copy to clipboardcrypto.timingSafeEqual, deduplicates events by Copy to clipboardevent_id in Copy to clipboardmpo_webhook_event, and dispatches real-time product, stock, customer, or order updates.
  • Prometheus Metrics: Exposes counters and gauges (Copy to clipboardodoo_sync_runs_total, Copy to clipboardodoo_sync_records_processed_total, Copy to clipboardodoo_sync_duration_ms_sum, Copy to clipboardodoo_rpc_requests_total, Copy to clipboardodoo_barcode_lookups_total, Copy to clipboardodoo_circuit_breaker_state, Copy to clipboardodoo_open_failures_total, Copy to clipboardodoo_open_conflicts_total) in both JSON and OpenMetrics text format (Copy to clipboardGET /admin/odoo/metrics?format=prometheus).

5. Database Schema (Copy to clipboardmpo_* Models)

All 10 DML models are defined in Copy to clipboardsrc/modules/odoo/models/index.ts and created by Copy to clipboardsrc/modules/odoo/migrations/Migration20260412000000.ts:

Model Export Table Name Primary Purpose & Key Columns Copy to clipboardOdooSetting Copy to clipboardmpo_setting Key-value JSON configuration store (Copy to clipboardkey unique index, Copy to clipboardvalue JSONB) for connection credentials and per-section settings (Copy to clipboardproduct, Copy to clipboardinventory, Copy to clipboardorders, Copy to clipboardcustomers, Copy to clipboardreconciliation, Copy to clipboardwebhooks, Copy to clipboardpos). Copy to clipboardErpMapping Copy to clipboardmpo_erp_mapping Cross-system entity link table (Copy to clipboardentity_type, Copy to clipboardmedusa_id, Copy to clipboardodoo_id, Copy to clipboardodoo_model, Copy to clipboardsync_direction, Copy to clipboardexternal_checksum, Copy to clipboardstatus, Copy to clipboardlast_synced_at, Copy to clipboardmetadata). Copy to clipboardErpSyncLog Copy to clipboardmpo_sync_log Execution audit log for sync runs (Copy to clipboardentity_type, Copy to clipboarddirection, Copy to clipboardtrigger, Copy to clipboardstatus, Copy to clipboardcreated_count, Copy to clipboardupdated_count, Copy to clipboardskipped_count, Copy to clipboardfailed_count, Copy to clipboardduration_ms, Copy to clipboardmessage, Copy to clipboarderror_details). Copy to clipboardErpSyncFailure Copy to clipboardmpo_sync_failure Dead-letter queue for failed entity sync operations (Copy to clipboardentity_type, Copy to clipboardmedusa_id, Copy to clipboardodoo_id, Copy to clipboarddirection, Copy to clipboardtrigger, Copy to clipboardpayload, Copy to clipboarderror_message, Copy to clipboardattempt_count, Copy to clipboardresolved, Copy to clipboardresolved_at, Copy to clipboardresolved_by). Copy to clipboardErpInventorySnapshot Copy to clipboardmpo_inventory_snapshot Point-in-time stock comparison records (Copy to clipboardproduct_id, Copy to clipboardvariant_id, Copy to clipboardsku, Copy to clipboardlocation_id, Copy to clipboardodoo_product_id, Copy to clipboardodoo_location_id, Copy to clipboardquantity_medusa, Copy to clipboardquantity_odoo, Copy to clipboarddelta, Copy to clipboardreconciled, Copy to clipboardresolution_action, Copy to clipboardsnapshot_at). Copy to clipboardErpReconciliationLog Copy to clipboardmpo_reconciliation_log Summary log for inventory drift reconciliation runs (Copy to clipboardreconciliation_type, Copy to clipboardstrategy, Copy to clipboarddrift_threshold, Copy to clipboardtriggered_by, Copy to clipboardstatus, Copy to clipboardchecked_count, Copy to clipboardmatched_count, Copy to clipboarddrifted_count, Copy to clipboardfixed_count, Copy to clipboardconflict_count, Copy to clipboarderror_count, Copy to clipboarddetails). Copy to clipboardErpConflictResolution Copy to clipboardmpo_conflict_resolution Manual review queue for stock or field conflicts (Copy to clipboardentity_type, Copy to clipboardmedusa_id, Copy to clipboardodoo_id, Copy to clipboardfield_name, Copy to clipboardmedusa_value, Copy to clipboardodoo_value, Copy to clipboardstrategy, Copy to clipboardstatus, Copy to clipboardresolved_value, Copy to clipboardresolved_by, Copy to clipboardresolved_at). Copy to clipboardBarcodeScanLog Copy to clipboardmpo_barcode_scan_log Telemetry log for POS & warehouse barcode scans (Copy to clipboardbarcode, Copy to clipboardcontext, Copy to clipboardvariant_id, Copy to clipboardodoo_product_id, Copy to clipboardsource, Copy to clipboardresolution_status, Copy to clipboardlatency_ms, Copy to clipboardscan_timestamp). Copy to clipboardOfflinePosTransaction Copy to clipboardmpo_offline_pos_transaction Durable queue for offline POS orders (Copy to clipboardexternal_transaction_id unique index, Copy to clipboardcustomer_id, Copy to clipboardcustomer_email, Copy to clipboardcurrency, Copy to clipboardtotal_cents, Copy to clipboarddiscount_cents, Copy to clipboarditems, Copy to clipboardstatus, Copy to clipboardmedusa_order_id, Copy to clipboardodoo_order_id, Copy to clipboardreplay_attempt_count, Copy to clipboardreplay_error). Copy to clipboardOdooWebhookEvent Copy to clipboardmpo_webhook_event Idempotency ledger for inbound Odoo webhooks (Copy to clipboardevent_id unique index, Copy to clipboardevent_type, Copy to clipboardodoo_model, Copy to clipboardodoo_record_id, Copy to clipboardstatus, Copy to clipboardpayload, Copy to clipboarderror_message, Copy to clipboardprocessed_at).

6. Medusa v2 Workflows & Compensation

Defined in Copy to clipboardsrc/workflows/index.ts and orchestrated with Copy to clipboardOdooModuleService:

Workflow / Operation Workflow ID / Service Method Step(s) Trigger & Compensation Behavior Copy to clipboardsyncProductsWithOdooWorkflow Copy to clipboardsync-products-with-odoo Copy to clipboardsync-products (Copy to clipboardsyncProductsStep) Triggered via Copy to clipboardPOST /admin/odoo/sync/products, Copy to clipboardproduct-updated subscriber, or scheduled cron. Records Copy to clipboardlogId in Copy to clipboardStepResponse and logs per-item failures to Copy to clipboardmpo_sync_failure. Copy to clipboardsyncInventoryWithOdooWorkflow Copy to clipboardsync-inventory-with-odoo Copy to clipboardsync-inventory (Copy to clipboardsyncInventoryStep) Triggered via Copy to clipboardPOST /admin/odoo/sync/inventory, Copy to clipboardinventory-updated subscriber, or scheduled cron. Syncs multi-warehouse stock and returns Copy to clipboardStepResponse(res, { logId }). Copy to clipboardsyncOrderToOdooWorkflow Copy to clipboardsync-order-to-odoo Copy to clipboardsync-order (Copy to clipboardsyncOrderStep → Copy to clipboardexecuteOrderSyncToOdoo) Triggered via Copy to clipboardorder.placed subscriber or Copy to clipboardPOST /admin/odoo/sync-order/:id. Queries order graph, creates/updates Odoo Copy to clipboardsale.order + optional Copy to clipboardaccount.move invoice & payment, and writes Copy to clipboardodoo_order_id / Copy to clipboardodoo_invoice_id back to order metadata. Copy to clipboardsyncCustomersWithOdooWorkflow (Copy to clipboardsyncCustomerWithOdooWorkflow) Copy to clipboardsync-customers-with-odoo Copy to clipboardsync-customers (Copy to clipboardsyncCustomersStep) Triggered via Copy to clipboardPOST /admin/odoo/sync/customers, Copy to clipboardcustomer-updated subscriber, or scheduled cron. Syncs Medusa customers ↔ Odoo Copy to clipboardres.partner. Copy to clipboardreconcileOdooInventoryWorkflow (Copy to clipboardreconcileInventoryDriftWorkflow) Copy to clipboardreconcile-odoo-inventory Copy to clipboardreconcile-inventory (Copy to clipboardreconcileInventoryStep) Triggered via Copy to clipboardPOST /admin/odoo/sync/reconciliation or Copy to clipboardodoo-reconciliation cron job. Captures Copy to clipboardmpo_inventory_snapshot rows and applies Copy to clipboardodoo_wins, Copy to clipboardmedusa_wins, or Copy to clipboardmanual_conflict. Copy to clipboardreplayOfflinePosTransactionWorkflow (Copy to clipboardreplayOfflinePosTransactionsWorkflow) Copy to clipboardreplay-offline-pos-transaction Copy to clipboardreplay-pos-transaction (Copy to clipboardreplayPosTransactionStep) Triggered via Copy to clipboardPOST /admin/odoo/pos-transactions (Copy to clipboardaction: "replay"). Replays queued offline POS transactions into Medusa and Odoo idempotently. Barcode Scan Resolution (Copy to clipboardresolveBarcodeScanWorkflow / Copy to clipboardodooService.resolveBarcode) Copy to clipboardodooService.resolveBarcode Cache → Copy to clipboardErpMapping → Medusa DB → Odoo RPC Triggered via Copy to clipboardPOST /store/odoo/barcode. Resolves barcode in Copy to clipboardpos, Copy to clipboardwarehouse, Copy to clipboardreceiving, or Copy to clipboardstocktake context and records Copy to clipboardmpo_barcode_scan_log. Inbound Webhook Processing (Copy to clipboardprocessOdooWebhookWorkflow / Copy to clipboardodooService.processWebhookEvent) Copy to clipboardodooService.processWebhookEvent HMAC Verify → Deduplicate Copy to clipboardevent_id → Dispatch Sync Triggered via Copy to clipboardPOST /hooks/odoo. Validates HMAC-SHA256 signature, records Copy to clipboardmpo_webhook_event, and updates mapped entities.

7. Subscribers & Scheduled Jobs

Event Subscribers (Copy to clipboardsrc/subscribers/)

File Subscriber ID Events Listened To Behavior & Loop Prevention Copy to clipboardorder-placed.ts Copy to clipboardodoo-order-placed-subscriber Copy to clipboardorder.placed Invokes Copy to clipboardexecuteOrderSyncToOdoo(container, { orderId, manual: false }) to create the Odoo Copy to clipboardsale.order, invoice, and payment when Copy to clipboardorderSync is enabled. Copy to clipboardproduct-updated.ts Copy to clipboardodoo-product-updated-subscriber Copy to clipboardproduct.created, Copy to clipboardproduct.updated Checks Copy to clipboardproduct section settings (Copy to clipboardenableProductSync and Copy to clipboarddirection in Copy to clipboardmedusa_to_odoo / Copy to clipboardbidirectional) and exports updated products using SHA-256 checksum comparison (Copy to clipboardexternal_checksum) to prevent infinite sync loops. Copy to clipboardinventory-updated.ts Copy to clipboardodoo-inventory-updated-subscriber Copy to clipboardinventory-level.updated Checks Copy to clipboardinventory section settings (Copy to clipboardenableStock and Copy to clipboarddirection in Copy to clipboardmedusa_to_odoo / Copy to clipboardbidirectional) and exports stock deltas to Odoo warehouses. Copy to clipboardcustomer-updated.ts Copy to clipboardodoo-customer-updated-subscriber Copy to clipboardcustomer.created, Copy to clipboardcustomer.updated Checks Copy to clipboardcustomers section settings (Copy to clipboardenableCustomerSync and Copy to clipboarddirection in Copy to clipboardmedusa_to_odoo / Copy to clipboardbidirectional) and syncs customer changes to Copy to clipboardres.partner.

Scheduled Jobs (Copy to clipboardsrc/jobs/)

File Job Name Cron Schedule Description Copy to clipboardodoo-scheduled-sync.ts Copy to clipboardodoo-scheduled-sync-job Copy to clipboard*/15 * * * * (configurable; e.g. Copy to clipboard0 */6 * * *) Verifies connection credentials are configured, then sequentially runs Copy to clipboardsyncProducts, Copy to clipboardsyncInventory, and Copy to clipboardsyncCustomers with Copy to clipboardtrigger: "scheduled". Copy to clipboardodoo-reconciliation.ts Copy to clipboardodoo-inventory-reconciliation-job Copy to clipboard0 */6 * * * (configurable; e.g. Copy to clipboard0 2 * * *) Verifies connection credentials and Copy to clipboardreconciliation.enableScheduledReconciliation !== false, then executes Copy to clipboardreconcileInventory({ triggeredBy: "scheduled" }).

8. Complete REST API Reference

Admin Endpoints (Copy to clipboard/admin/odoo/*)

Method Path Validator Schema Description Copy to clipboardGET Copy to clipboard/admin/odoo/status — Returns connection status (Copy to clipboardconnected, Copy to clipboarddisconnected, Copy to clipboardunconfigured), active protocol, circuit breaker state, Odoo server version, and entity counters. Copy to clipboardGET Copy to clipboard/admin/odoo/config — Returns the current connection configuration with secrets (Copy to clipboardpassword, Copy to clipboardapiKey, Copy to clipboardwebhookSecret) masked via Copy to clipboardredactOdooConfig. Copy to clipboardPOST Copy to clipboard/admin/odoo/config Copy to clipboardOdooConfigSchema Validates URL safety (Copy to clipboardvalidateSafeOdooUrl), preserves existing secrets when omitted, and saves connection settings to Copy to clipboardmpo_setting. Copy to clipboardPOST Copy to clipboard/admin/odoo/verify-connection Copy to clipboardOdooVerifyConnectionSchema Tests live connectivity against Odoo and returns Copy to clipboarduid, Copy to clipboardserverVersion, Copy to clipboardcompanies, Copy to clipboardwarehouses, Copy to clipboardjournals, and Copy to clipboardcategories. Copy to clipboardGET Copy to clipboard/admin/odoo/sections/:section — Reads section settings for Copy to clipboardproduct, Copy to clipboardinventory, Copy to clipboardorders, Copy to clipboardcustomers, Copy to clipboardreconciliation, Copy to clipboardwebhooks, or Copy to clipboardpos. Copy to clipboardPOST Copy to clipboard/admin/odoo/sections/:section — Merges and persists partial settings for the specified Copy to clipboard:section. Copy to clipboardGET Copy to clipboard/admin/odoo/options — Fetches Medusa Copy to clipboardstockLocations, Copy to clipboardcollections, and Copy to clipboardsalesChannels alongside Odoo Copy to clipboardcompanies, Copy to clipboardwarehouses, Copy to clipboardjournals, and Copy to clipboardcategories. Copy to clipboardPOST Copy to clipboard/admin/odoo/sync/:entity Copy to clipboardOdooTriggerSyncSchema Triggers manual sync for Copy to clipboardproducts, Copy to clipboardinventory, Copy to clipboardcustomers, Copy to clipboardreconciliation, or Copy to clipboardall. Copy to clipboardPOST Copy to clipboard/admin/odoo/sync-order/:id — Manually syncs a specific Medusa order ID to Odoo Copy to clipboardsale.order (with optional invoice and payment). Copy to clipboardGET Copy to clipboard/admin/odoo/mappings — Lists Copy to clipboardmpo_erp_mapping rows filtered by optional Copy to clipboardentity_type and Copy to clipboardmedusa_id. Copy to clipboardPOST Copy to clipboard/admin/odoo/mappings Copy to clipboardOdooUpsertMappingSchema Creates or updates an explicit Copy to clipboardErpMapping link between a Medusa ID and an Odoo ID. Copy to clipboardGET Copy to clipboard/admin/odoo/logs — Returns recent Copy to clipboardmpo_sync_log runs, Copy to clipboardmpo_reconciliation_log runs, and Copy to clipboardmpo_inventory_snapshot records. Copy to clipboardGET Copy to clipboard/admin/odoo/failures — Lists dead-letter Copy to clipboardmpo_sync_failure records filtered by Copy to clipboardresolved. Copy to clipboardPOST Copy to clipboard/admin/odoo/failures Copy to clipboardOdooResolveFailureSchema Marks a dead-letter Copy to clipboardmpo_sync_failure record as resolved. Copy to clipboardGET Copy to clipboard/admin/odoo/conflicts — Lists Copy to clipboardmpo_conflict_resolution records filtered by Copy to clipboardstatus (Copy to clipboardopen / Copy to clipboardresolved). Copy to clipboardPOST Copy to clipboard/admin/odoo/conflicts Copy to clipboardOdooResolveConflictSchema Resolves an inventory drift conflict using Copy to clipboardodoo_wins, Copy to clipboardmedusa_wins, or Copy to clipboardcustom. Copy to clipboardGET Copy to clipboard/admin/odoo/pos-transactions — Lists offline POS transactions (Copy to clipboardmpo_offline_pos_transaction). Copy to clipboardPOST Copy to clipboard/admin/odoo/pos-transactions Copy to clipboardOdooPosTransactionActionSchema Enqueues (Copy to clipboardaction: "enqueue") or replays (Copy to clipboardaction: "replay") an offline POS transaction. Copy to clipboardGET Copy to clipboard/admin/odoo/metrics — Returns Prometheus text exposition when Copy to clipboard?format=prometheus is passed, or JSON metrics plus Prometheus string otherwise.

Store & Webhook Endpoints

Method Path Validator Schema Description Copy to clipboardPOST Copy to clipboard/store/odoo/barcode Copy to clipboardOdooBarcodeLookupSchema Resolves a scanned barcode/EAN-13/SKU for Copy to clipboardpos, Copy to clipboardwarehouse, Copy to clipboardreceiving, or Copy to clipboardstocktake context. Returns Copy to clipboard200 when found or Copy to clipboard404 when unmatched. Copy to clipboardPOST Copy to clipboard/hooks/odoo Copy to clipboardOdooWebhookBodySchema (Copy to clipboardpreserveRawBody: true) Verifies Copy to clipboardx-odoo-signature / Copy to clipboardx-webhook-signature via HMAC-SHA256, deduplicates Copy to clipboardevent_id, and processes inbound Odoo events.

9. Typed SDK (Copy to clipboardmedusa-plugin-odoo/sdk) & React Hooks (Copy to clipboardmedusa-plugin-odoo/hooks)

Typed SDK Usage

import {
createOdooSdk,
defaultOdooSdk,
odooQueryKeys,
} from "@vicacha-devs/medusa-plugin-odoo/sdk"
const odooSdk = createOdooSdk({
baseUrl: process.env.MEDUSA_BACKEND_URL,
})
// Admin operations
const status = await odooSdk.admin.getStatus()
const syncRes = await odooSdk.admin.triggerSync("products", {
direction: "bidirectional",
})
// Storefront / POS barcode resolution
const scan = await odooSdk.store.lookupBarcode({
barcode: "4006381333931",
context: "pos",

React Hooks Usage

All hooks are exported from Copy to clipboard@vicacha-devs/medusa-plugin-odoo/hooks and built on lightweight, zero-boilerplate query/mutation primitives (Copy to clipboarduseOdooQuery, Copy to clipboarduseOdooMutation) with automatic cache invalidation:

  • Query Hooks: Copy to clipboarduseOdooStatus, Copy to clipboarduseOdooConfig, Copy to clipboarduseOdooSectionSettings, Copy to clipboarduseOdooOptions, Copy to clipboarduseOdooMappings, Copy to clipboarduseOdooSyncLogs, Copy to clipboarduseOdooFailures, Copy to clipboarduseOdooConflicts, Copy to clipboarduseOdooPosTransactions.
  • Mutation Hooks: Copy to clipboarduseSaveOdooConfig, Copy to clipboarduseVerifyOdooConnection, Copy to clipboarduseSaveOdooSectionSettings, Copy to clipboarduseTriggerOdooSync, Copy to clipboarduseSyncOrderToOdoo, Copy to clipboarduseResolveOdooFailure, Copy to clipboarduseResolveOdooConflict, Copy to clipboarduseBarcodeLookup.

10. Decoupled Admin UI, Widgets & 10-Locale i18n

5 Admin Routes (Copy to clipboardsrc/admin/routes/odoo/)

  • Copy to clipboard/app/odoo (Copy to clipboardsrc/admin/routes/odoo/page.tsx): Main overview dashboard featuring Copy to clipboardOdooHeader, 4 KPI Copy to clipboardStatCards, a 2×2 Copy to clipboardNavigationCard grid linking to sub-routes, and Copy to clipboardOverviewTab manual bidirectional sync controls.
  • Copy to clipboard/app/odoo/connection (Copy to clipboardsrc/admin/routes/odoo/connection/page.tsx): Two-column layout with Copy to clipboardConnectionTab (Copy to clipboardKeyboundForm credentials, protocol selector, private-network toggle) in Copy to clipboardmain and Copy to clipboardConnectionSecuritySideSection in Copy to clipboardside.
  • Copy to clipboard/app/odoo/settings (Copy to clipboardsrc/admin/routes/odoo/settings/page.tsx): Two-column layout with Copy to clipboardProductSyncSettingsSection & Copy to clipboardOrderSyncSettingsSection in Copy to clipboardmain, and Copy to clipboardInventorySyncSettingsSection & Copy to clipboardReconciliationSettingsSection in Copy to clipboardside.
  • Copy to clipboard/app/odoo/logs (Copy to clipboardsrc/admin/routes/odoo/logs/page.tsx): Single-column observability view rendering Copy to clipboardSyncFailuresSection, Copy to clipboardDriftConflictsSection, and Copy to clipboardRecentSyncRunsSection.
  • Copy to clipboard/app/odoo/barcode (Copy to clipboardsrc/admin/routes/odoo/barcode/page.tsx): Two-column POS & warehouse tool pairing Copy to clipboardBarcodeLookupSection with Copy to clipboardPosTransactionsSection.

2 Admin Detail Widgets (Copy to clipboardsrc/admin/widgets/)

  • Copy to clipboardorder-odoo-widget.tsx (Copy to clipboardorder.details.after): Displays Copy to clipboardOrderOdooSummary with Odoo Copy to clipboardsale.order and Copy to clipboardaccount.move invoice badges plus one-click manual order sync / re-verification.
  • Copy to clipboardproduct-odoo-widget.tsx (Copy to clipboardproduct.details.after): Displays the linked Odoo Copy to clipboardproduct.template ID badge and one-click catalog sync button.

18 Modular Components (Copy to clipboard< 170 lines each) & 10-Locale i18n

  • Every component under Copy to clipboardsrc/admin/components/ is strictly under 170 lines and uses Copy to clipboard@medusajs/ui primitives (Copy to clipboardContainer, Copy to clipboardHeading, Copy to clipboardText, Copy to clipboardStatusBadge, Copy to clipboardBadge, Copy to clipboardButton, Copy to clipboardTable, Copy to clipboardInput, Copy to clipboardSelect, Copy to clipboardSwitch, Copy to clipboardSkeleton, Copy to clipboardToaster).
  • Full 10-locale Admin internationalization (Copy to clipboarden, Copy to clipboardes, Copy to clipboardfr, Copy to clipboardde, Copy to clipboardit, Copy to clipboardpt, Copy to clipboardnl, Copy to clipboardpl, Copy to clipboardtr, and Copy to clipboardar with RTL support) under Copy to clipboardsrc/admin/i18n/.

11. Security Architecture

Implemented in Copy to clipboardsrc/modules/odoo/utils/security.ts:

  1. SSRF Protection (Copy to clipboardvalidateSafeOdooUrl):
    • Enforces Copy to clipboardhttp: or Copy to clipboardhttps: protocols only.
    • Rejects URLs with embedded Copy to clipboardusername or Copy to clipboardpassword credentials.
    • Blocks cloud metadata endpoints (Copy to clipboard169.254.169.254, Copy to clipboardmetadata.google.internal, Copy to clipboardmetadata.goog, Copy to clipboard100.100.100.200, Copy to clipboardfd00:ec2::254, Copy to clipboard169.254.*).
    • Blocks loopback and private RFC1918/RFC6598/IPv6 ULA ranges (Copy to clipboardlocalhost, Copy to clipboard*.local, Copy to clipboard*.internal, Copy to clipboard127.0.0.0/8, Copy to clipboard10.0.0.0/8, Copy to clipboard172.16.0.0/12, Copy to clipboard192.168.0.0/16, Copy to clipboard100.64.0.0/10, Copy to clipboard::1, Copy to clipboardfe80::, Copy to clipboardfc00::/7) unless Copy to clipboardallowPrivateNetwork: true is explicitly enabled for local development.
  2. Credential Redaction (Copy to clipboardredactOdooConfig & Copy to clipboardredactSecret):
    • Masks Copy to clipboardpassword, Copy to clipboardapiKey, and Copy to clipboardwebhookSecret (Copy to clipboardab****yz or Copy to clipboard******) before returning configuration objects from Copy to clipboard/admin/odoo/config while providing boolean Copy to clipboardhasPassword, Copy to clipboardhasApiKey, and Copy to clipboardhasWebhookSecret indicators.
  3. Timing-Safe Webhook Verification (Copy to clipboardverifyOdooWebhookSignature):
    • Computes Copy to clipboardHMAC-SHA256 over the unparsed Copy to clipboardrawBody buffer (Copy to clipboardpreserveRawBody: true in Copy to clipboardsrc/api/middlewares.ts) and compares hex digests using Copy to clipboardcrypto.timingSafeEqual.
  4. Rate Limiting & Circuit Breaker (Copy to clipboardOdooClient):
    • Token-bucket throttling (Copy to clipboardrateLimitPerSec) prevents overwhelming Odoo worker processes, while the circuit breaker trips to Copy to clipboardopen after Copy to clipboardcircuitThreshold consecutive failures and probes recovery in Copy to clipboardhalf-open after Copy to clipboardcircuitResetMs.

12. Development & Testing Commands

# Typecheck all backend and Admin UI TypeScript files
npm run typecheck
# Run the full test suite (Node native test runner + TypeScript resolver)
npm test
# Build the Medusa plugin bundle (.medusa/server)
npm run build
# Start plugin development watch mode
npm run dev

You may also like

Browse all integrations

Build your own

Develop your own custom integration

Build your own integration with our API to speed up your processes. Make your integration available via npm for it to be shared in our Library with the broader Medusa community.

gift card interface

Ready to build your custom commerce setup?