BusinessTransaction
A BusinessTransaction is a unified business document. The same
model represents rentals, purchase orders, transfers, RMAs, and sales —
the kind field discriminates.
| Field | Type | Notes |
|---|---|---|
id | integer | |
kind | enum | RENTAL, PURCHASE_ORDER, TRANSFER, RMA, SALE, QUARANTINE |
number | string | Tenant-scoped sequence (e.g. RNT-2026-00042) |
current_state | string | From the configured state machine |
from_party_id | integer | Source party (role depends on kind) |
to_party_id | integer | Destination party |
from_location_id | integer | |
to_location_id | integer | |
expected_at | timestamp | When fulfilment is expected |
due_at | timestamp | Due/return date |
completed_at | timestamp | When the lifecycle ended |
metadata | object | Per-vertical fields |
Lines
Each transaction has one or more business_transaction_lines:
| Field | Type | Notes |
|---|---|---|
product_id | integer | The "what" |
instance_id | integer | Optional — pinned to a specific instance |
requested_qty | number | What was asked for |
allocated_qty | number | What the allocator picked (projection) |
fulfilled_qty | number | What was actually moved (projection) |
returned_qty | number | For rentals (projection) |
lost_qty | number | For rentals (projection) |
Lifecycle
The lifecycle (states + allowed transitions) is defined per tenant per
kind in a configurable state machine. Default machines are shipped
in the vertical packs and can be
overridden per tenant.
Mapping by kind
| Kind | from_party | to_party | What it means |
|---|---|---|---|
RENTAL | tenant | renter | Items rented out |
PURCHASE_ORDER | supplier | tenant | Items ordered in |
TRANSFER | tenant | tenant | Internal location move |
RMA | renter / customer | tenant | Return / replacement |
SALE | tenant | customer | One-way sale |
QUARANTINE | tenant | tenant | Held pending QC (pharma) |