# Inbound Shipment — Models & Action Visibility Matrix

## Models Involved

Source of truth: `@tailor-platform/erp-kit` v0.17.0 (see `package.json`).

| Model | erp-kit model | Role in this flow |
|---|---|---|
| InboundShipment | `InboundShipment` (erp-kit `inbound-shipment`) | Receipt header; owns `status`, native `docNumber` serial (`ISH-%d`), receipt date |
| InboundShipmentLine | (erp-kit `inbound-shipment`) | Received quantity per PO line, plus the source-document link (`sourceDocumentType = PURCHASE_ORDER`, `sourceDocumentId` = the PO, `sourceLineId` = the PO line — all required) |
| PurchaseOrder / PurchaseOrderLine | `PurchaseOrder` | Backing order (required); receipt updates `receiptStatus` on post |

### Status Axis

| Field | Values |
|---|---|
| `status` | `DRAFT` → `POSTED` \| `CANCELLED` |

The state machine is owned by the native erp-kit `inbound-shipment` module.

## Action Visibility Matrix

The `inbound-shipment-detail` screen's action panel gates buttons on the inbound shipment's `status` plus, for one action, the backing PO's `receiptStatus`. Rendered by `inbound-shipment-actions.tsx`.

Legend: ✓ visible+enabled · ◐ visible but disabled · blank = hidden.

| Action | Resolver / target | DRAFT | POSTED | CANCELLED | Extra condition | Role |
|---|---|:-:|:-:|:-:|---|---|
| Edit Inbound Shipment | _navigate to edit form_ | ✓ |  |  | — | purchaser |
| Post / Settle | `settleInboundShipment` (→ `postInboundShipment`) | ✓ |  |  | — | purchaser |
| Cancel Inbound Shipment | `cancelInboundShipment` | ✓ |  |  | — | purchaser |
| Create Inbound Shipment for Remaining | `createRemainingInboundShipment` |  | ✓ / ◐ |  | requires a backing PO; ◐ (disabled) when `po.receiptStatus === RECEIVED` | purchaser |
| View Purchase Order | _navigate to PO detail_ |  | ✓ |  | requires a backing PO | purchaser |
| Back | _navigate to list_ | ✓ | ✓ | ✓ | — | — |
