Products

Stock Management

What moves stock, what warns you about it, and how to see the history behind a number.

Last updated 2026-10-13

DigitalKey ERP — Docs · digital-key.co/docs/products/stock

What changes stock

Stock is never edited directly. It changes as a consequence of something happening, and each change is written to the movement history so a quantity can always be explained.

EventEffect
POS sale completedDecreases
Sales order moved to completedDecreases — and only at that point
Sale or completed order voidedIncreases — the movement is reversed
Customer returnIncreases by the quantity returned
Finished invoice editedMoves by the difference only, up or down
Goods received against a purchaseIncreases
Purchase returnDecreases
Warehouse transferMoves between locations; the total is unchanged
Stock adjustmentSet to the counted figure, up or down
Damage recordedDecreases, and posts the value as a loss
Voided sale or purchase restored from the recycle binRe-applies the original movement
NoteStock is counted in the product's stock unit. For a product sold by the piece that is single pieces: a carton line of 24 moves 24.
WarningA draft, pending or approved sales order does not hold or reduce stock. Nothing moves until the order reaches completed, so an approved order can still fail if the goods are sold at the counter first.

No selling what is not in stock

A POS sale, a sales order being completed, and an invoice edit that sends more out are all refused when the product's stock is short. This applies to everyone and cannot be overridden. Quantities are added up per product across the lines of the invoice, and two tills selling the last unit at the same moment cannot both succeed.

TipIf a sale is refused but the goods are physically there, the count is wrong, not the rule. Receive the purchase that brought them in, or post a stock adjustment, then sell.

Low-stock alerts

Each product has a qty_alert threshold. When stock is at or below it, the product is treated as low.

ParameterTypeRequiredDescription
qty_in_stockdecimalOptionalCurrent quantity on hand.
qty_alertdecimalOptionalThreshold at or below which the product is flagged as low.
Requires subscriptionwarehouse.alerts2,000 IQD / month
NoteThe flag in the product list works with no subscription. What the feature adds is a warehouse alerts view that collects everything currently below threshold. The counter warning (pos.low_stock_alert) is no longer sold; businesses that already hold it keep it.
Products — Low stock indicator
Low stock indicator
Low stock indicator — A product list with items at or below their alert level highlighted.

Recording damage

Goods broken, expired or otherwise lost are written off with a damage record. This removes them from stock and keeps a reason on file, so shrinkage does not masquerade as an unexplained count difference later.

Requires subscriptionproduct.damage3,000 IQD / month
Damage record
ParameterTypeRequiredDescription
qtydecimalRequiredQuantity being written off.
warehouse_idintegerOptionalWhich location the loss came from.
reasonstringOptionalWhy it was written off — broken, expired, lost.
notesstringOptionalAny further detail.
unit_costdecimalOptionalThe product's average cost at the time. Read-only.
total_costdecimalOptionalValue of the loss — quantity multiplied by unit cost. Read-only.
expense_idintegerOptionalThe expense entry raised for the loss. Read-only.
TipThe damage record raises a matching expense, so written-off stock shows up as a real loss in profit and loss instead of quietly vanishing from inventory. It is the one expense that is not cash: the stock left, not the money, so it does not appear as cash going out in the cash flow.

Movement history

Every change is recorded with the quantity before and after, which is what lets you answer “why does this say 4 when I counted 6”.

Stock movement
ParameterTypeRequiredDescription
move_idintegerOptionalIdentifier for the movement.
product_idintegerOptionalProduct that moved.
warehouse_idintegerOptionalLocation involved.
move_typestringOptionalWhat caused it — sale, purchase, transfer, adjustment, damage, void.
qtydecimalOptionalSize of the change.
qty_beforedecimalOptionalQuantity immediately before.
qty_afterdecimalOptionalQuantity immediately after.
notestringOptionalFree-text detail recorded with the movement.
moved_attimestampOptionalWhen it happened.

Related