Dentolize · Stock Counts Walkthrough
On this pageTermsData modelRelated reading

Glossary & Data Model

Terms

Stock Count — a physical inventory session: a snapshot of expected stock for one or more storages, counted against by staff, and closed by confirming (optionally updating live stock) or cancelling.

Stock Count Item (line) — one item/storage combination within a count; the unit of counting. Corresponds 1:1 with an InventoryLocation that had stock when the count opened.

Open / Confirmed / Cancelled — the three states a count can be in (StockCountStatus). Only an OPEN count can be counted, edited, confirmed, cancelled, or deleted.

All-storages count — a count opened with no specific inventoryStorage, which locks every storage in the company for its duration. Flagged in the UI as "All storages will be counted and blocked."

Locking / locked storage — an InventoryStorage currently held by an open count (lockedByStockCountId set). While locked, no other inventory-moving transaction can touch it.

Expected amount/value — the frozen snapshot a count started with: what the system believed was in a location when the count opened, computed once and never recalculated even if live stock or pricing changes afterward.

Counted amount/value — what a counter actually recorded for a line. null until counted; distinguishing "counted as zero" from "not yet looked at."

Variancecounted − expected, stored (not derived on read) on each line and rolled up onto the count, so lists can sort/filter on it directly.

Adjustment order — a normal InventoryOrder of type ADJUSTMENT, optionally created when a count is confirmed with "update stock," carrying one line per line that varied. Booked through the same code path as any other inventory order type.

Confirm without changing stock / Confirm and update stock — the two explicit outcomes of confirming a count. The former just records the count; the latter also books the adjustment order described above.

View Created Stock Count — a permission that scopes a user's visibility to only the counts they personally created, as opposed to View Stock Count which shows every count in the company.

Data model

StockCount (packages/prisma/schema.prisma:4421)

FieldNotes
numberSequential per company (#1, #2…), separate from the UUID id
statusOPEN \CONFIRMED \CANCELED
inventoryStorage / inventoryStorageIdnull means "all storages"
isMasterPassed through from creation; not derived
totalItems, countedItemsLine counts, kept in sync by recalculateStockCountTotals
expectedAmount, expectedAmountBox, expectedValueFrozen at open time, never recomputed
countedAmount, countedAmountBox, countedValueRolled up from counted lines only
varianceAmount, varianceValueRolled up from counted lines; stored, not derived on read
stockUpdatedtrue once an adjustment order has been booked for this count
inventoryOrder / inventoryOrderIdThe ADJUSTMENT order this count produced, if any (unique — one order per count)
confirmedAt, confirmedBySet on confirm or cancel (shared fields for "when this count stopped being open")
lockedStoragesReverse relation: storages currently pointing their lock at this count

StockCountItem (packages/prisma/schema.prisma:4474)

FieldNotes
codee.g. 12-003 — survives Excel export/re-import; what upload rows match against first
box, price, dueFrozen from the InventorySubItem at count-open time
expectedAmount, expectedAmountBox, expectedValueThe snapshot for this one line
countedAmount, countedAmountBox, countedValuenull until counted
varianceAmount, varianceValuenull until counted (not zero — no answer yet, not "no difference")
countedAt, countedByWho counted this line and when; null = not yet counted
Unique constraints[stockCountId, inventoryStorageId, inventorySubItemId] (one line per variation per storage per count) and [stockCountId, code] (codes unique within a count)

InventoryStorage additions

FieldNotes
lockedByStockCount / lockedByStockCountIdSet while a count holds this storage; cleared on confirm/cancel/delete