Skip to content

inventory.transit_loss

Pérdida en tránsito recorded at receive time when the user picks the 'register as transit loss' resolution for a short-receive (received < shipped). Constanza posts a merma póliza Dr 5005 / Cr 1151 when totalCost is present, and persists an audit row in caracol_inventory_transit_losses keyed on (movementId, productId, branchId) for idempotency. Sender clears source.reserved by the full shipped quantity but does NOT restore source.quantity — the diff is written off as merma. Restore-to-source resolution does NOT emit this event (no loss occurred).

Senders

  • caracol

Receivers

  • constanza

Data schema

Each field maps to a type hint. | null indicates an optional field.

json
{
  "type": "object",
  "required": [
    "tenantId",
    "productId",
    "productName",
    "branchId",
    "shortfall",
    "movementId",
    "resolvedBy",
    "ts"
  ],
  "properties": {
    "tenantId": {
      "type": "string",
      "description": "Caracol tenant ID"
    },
    "productId": {
      "type": "string",
      "description": "Caracol product Firestore doc id"
    },
    "productName": {
      "type": "string"
    },
    "branchId": {
      "type": "string",
      "description": "Source (fulfilling) branch id where the loss happened"
    },
    "shortfall": {
      "type": "number",
      "description": "Number of units lost in transit (shipped - received)"
    },
    "movementId": {
      "type": "string",
      "description": "Caracol inventoryMovements doc id — used together with productId+branchId for idempotent dedup"
    },
    "resolvedBy": {
      "type": "string",
      "description": "User id who picked the loss resolution at receive time"
    },
    "reason": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional motive, persisted to binnacle and audit row"
    },
    "ts": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp when the loss was recorded"
    },
    "totalCost": {
      "type": [
        "number",
        "null"
      ],
      "description": "FIFO-derived cost of the lost units (MXN). When present, Constanza posts the merma póliza at this cost. Absent → audit row persisted alone for manual reconciliation."
    },
    "denunciaNumber": {
      "type": [
        "string",
        "null"
      ],
      "description": "Police report number for theft cases (Topic 16 OL-3 Gap 5.1 — additive optional field for fiscal-deductibility evidence)."
    },
    "liablePartyType": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "origin_branch",
        "baul",
        "destination_branch",
        null
      ],
      "description": "Liability assignment for transit loss (Topic 16 OL-3 Gap 5.2 — feeds baul_liability path when set to 'baul')."
    }
  }
}

Example payload

The following is a synthetic payload that matches the schema. Production payloads are signed with HMAC-SHA256 and delivered to each receiver's registered webhook endpoint.

json
{
  "type": {},
  "required": "example-required",
  "properties": "example-properties"
}

See also


Generated from ecosystem-sdk/packages/mcp-server/src/registry/events.json. Do not edit by hand.

Red Broom Software Ecosystem