# Inventory Transactions

---
id: inventory-guide
title: Inventory Transactions
hide_table_of_contents: true
sidebar_label: Inventory Transactions
---

## Receiving Stock

When parts arrive from a supplier, record a receipt transaction to increase on-hand stock.

### Via the UI

1. In **Inventory → Parts**, expand the part row.
2. Click **Add Part Transaction** (the **+** icon in the Parts Inventory toolbar).
3. The **Part Inventory Editor** opens.

| Field | Description |
|---|---|
| **Inventory Location** | The storeroom location receiving the stock |
| **Qty** | Quantity received (must be > 0) |
| **Transaction Type** | Select `Receipt to inventory` |
| **Lot / Batch** | Optional lot or batch number |
| **Notes** | Optional reference notes (e.g. PO number) |

Click **Save**. The on-hand balance updates immediately and the transaction is recorded in the history.

### Via Script

```python
inventoryTransactionId, err = system.kanoa.inventory.addInventoryTransaction({
    'inventoryAssetId':           warehouseAssetId,
    'partId':                     partId,
    'quantity':                   100,
    'inventoryTransactionTypeId': receiptTypeId,
    'supplierId':                 supplierId,
    'referenceType':              'PO',
    'referenceNumber':            'PO-2026-0441',
    'unitCost':                   3.75,
}, userId)
```

---

## Issuing Parts

### Ad-hoc Issue

To issue parts without a work order (e.g. a one-off repair or adjustment):

1. Expand the part in **Inventory → Parts**.
2. Click **Add Part Transaction**.
3. Set **Transaction Type** to `Issue` (or the appropriate type for your operation).
4. Enter quantity, location, and optional notes.
5. Click **Save**.

### Issue Against a Maintenance Work Order

Parts consumed during a maintenance activity can be tracked directly against the work order event. This provides full traceability between stock consumption and maintenance history.

```python
inventoryTransactionId, err = system.kanoa.inventory.issuePartToWorkOrderEvent({
    'partId':            partId,
    'quantity':          2,
    'workOrderEventId':  workOrderEventId,
    'inventoryAssetId':  warehouseAssetId,
    'assetId':           maintainedAssetId,
    'usedBy':            technicianUserId,
    'unitCost':          3.75,
}, userId)
```

To retrieve all parts consumed against a set of work order events:

```python
data = system.kanoa.inventory.getPartsUsedByWorkOrderEvents({
    'workOrderEventId': workOrderEventId,
})
```

---

## Transfers and Adjustments

A transfer moves stock from one inventory location to another. Use `Transfer in` and `Transfer out` transaction types to record the movement at each end.

If a physical count reveals a discrepancy, use a `Positive adjustment` or `Negative adjustment` transaction type to correct the on-hand balance. The transaction history records who made the adjustment and when.

Both operations use **Add Part Transaction** in the UI or `addInventoryTransaction` via script with the appropriate transaction type.

---

## Stock Visibility

The expanded part row in **Inventory → Parts** shows the live stock position at each location:

| Column | Description |
|---|---|
| **On Hand** | Current physical quantity in the storeroom |
| **Reserved** | Quantity allocated to open work orders but not yet physically removed |
| **On Order** | Quantity on open purchase orders not yet received |
| **Available** | On Hand minus Reserved |
| **Min / Max** | Policy bounds for this location |
| **Reorder Point** | Policy reorder trigger |
| **Reorder Qty** | Policy reorder quantity |
| **Safety Stock** | Policy safety buffer |
| **UOM** | Unit of measure |
| **Cycle Count** | Days between physical counts |
| **Managed Stock** | Whether a stocking policy is active |

### Finding Parts Below Reorder Threshold

```python
data = system.kanoa.inventory.getPartInventoryStock({
    'inventoryAssetId':        warehouseAssetId,
    'isStocked':               True,
    'isBelowReorderThreshold': True,
})
```

---

## Transaction History

Every stock movement is stored as a transaction. The transaction list visible in the expanded part row shows:

| Column | Description |
|---|---|
| **Id** | Transaction ID |
| **Type** | Transaction type (Receipt, Issue, Transfer, Adjustment, etc.) |
| **From/To Asset** | Asset associated with the movement |
| **Qty** | Quantity moved |
| **Cost Center** | Financial charge code |
| **Transaction Date** | When the movement occurred |
| **Ref #** | Purchase order, work order, or other reference |
| **Last Updated By** | User who recorded the transaction |

Transaction history is immutable — corrections are made via adjustment transactions, not by editing existing records.
