How Stock Movements Work
Stock is recorded as a ledger of movements. Every receipt, issue, transfer and adjustment is a row, and rows are never updated and never deleted. On-hand quantity is a sum over those movements, calculated rather than stored.
Why not just store a quantity
A quantity column that anything can update is a quantity column that will eventually be wrong, with no record of when it went wrong or what changed it. Every stock system that has ever needed a stocktake to "fix the numbers" works that way.
Deriving the figure removes the possibility. If on-hand is the sum of movements, then on-hand cannot disagree with the movements — and if the number looks wrong, the movements tell you exactly which transaction made it so, and when.
Corrections are movements
You do not edit a mistaken movement. You post a reversing one. Both remain visible, which is what lets you answer why a figure changed rather than merely observing that it did. This is the same principle the ledger applies to journals, for the same reason.
The balances cache
Summing a long movement history on every screen would be slow, so a balances table caches the current position. It is only a cache. It holds no information the movements do not, and it can be rebuilt from them at any time.
That matters practically: if a balance ever looks wrong, rebuilding it is safe and loses nothing. Contrast a stored quantity, where a rebuild is impossible because there is nothing authoritative to rebuild from.
Getting stock in to begin with
Opening balances are movements like any other — a receipt per item and location, dated to your go-live. Do not write opening quantities into the cache directly. They would be correct until the first rebuild and then vanish, which is a genuinely confusing failure.
Locations
Movements record where stock went as well as what moved, so a transfer is an issue from one location and a receipt into another. Model locations at the granularity you will actually count at — bins you never physically verify are administrative fiction.