Every movement of stock is written to a stock ledger — receipts from suppliers, issues against sales, transfers between warehouses and manual adjustments. Nothing changes quantity without leaving a row you can trace.
Goods coming in are recorded through a Goods Receipt against a purchase order. Goods going out are relieved automatically when you deliver or invoice. Because the accounting entry is produced by the same action, your stock value in the balance sheet and your stock quantity on the shelf come from the same source and cannot drift apart.
For multi-location businesses each warehouse keeps its own balances while rolling up into one company-wide figure.
If a physical count disagrees with the system, record an adjustment rather than editing history. The adjustment posts its own voucher, so the difference is visible in your accounts and someone can be asked about it later — which is exactly what an auditor will want to see.