Skip to content

Inbound Endpoints (Odoo -> Middleware)

These accept data from Odoo and store it with change detection.

POST /api/v1/products

Sync one or more products. Accepts a single product object or a batch:

// Single product
{
  "external_id": "PROD-001",
  "name": "Widget A",
  "price": 29.99,
  "description": "A fine widget"
}

// Batch
{
  "products": [
    { "external_id": "PROD-001", "name": "Widget A" },
    { "external_id": "PROD-002", "name": "Widget B" }
  ]
}

Response (200):

{
  "success": true,
  "processed": 2,
  "created": 1,
  "updated": 1,
  "errors": []
}

Side effects:

  • Prices are extracted into PricelistItem records (only flagged if value actually changed)
  • Purchase orders are extracted into PurchaseOrder + PurchaseOrderLine records
  • changedFields is computed via field-level diff

POST /api/v1/partners

Sync partners with hierarchy support. Partners can reference a parent via parent_external_id.

{
  "partners": [
    {
      "external_id": "PARTNER-001",
      "name": "Acme Corp",
      "type": "B"
    },
    {
      "external_id": "PARTNER-002",
      "name": "Acme Billing",
      "type": "C",
      "parent_external_id": "PARTNER-001"
    }
  ]
}

Partner types: B (Billing), C (Contact), D (Delivery), O (Anonymous Shipment).

Batch operations sort by dependency (parents processed first) and detect circular references.

POST /api/v1/sale-orders

Sync sale orders (single or batch). Supports direction field: inbound (from Odoo) or outbound (to Odoo).

POST /api/v1/stocks

Bulk stock updates. Uses efficient SQL-level upserts for performance with 2800+ products.

{
  "stocks": [
    {
      "supplier_external_id": "SUP-001",
      "product_external_id": "PROD-001",
      "quantity": 150,
      "purchase_price": 15.00,
      "suggested_sale_price": 29.99
    }
  ]
}

Tracks isQuantityChanged flag for delta queries.

POST /api/v1/purchase-orders

Direct purchase order sync (alternative to extraction from product data).