Stock rules and costing
Zhmara X keeps a running stock quantity and an average cost for every item in every warehouse (and per variant and batch). A few firm rules keep stock and its value correct. Knowing them explains most stock messages you will see.
What moves stock
| In | Out |
|---|---|
| Approved purchase bills | Approved sales invoices and POS sales |
| Credit notes (customer returns) | Debit notes (returns to suppliers) |
| Opening stock and stock adjustments (addition) | Stock adjustments (subtraction) |
| Stock transfers (into the receiving warehouse) | Stock transfers (out of the sending warehouse) |
| Stock count differences (found) | Stock count differences (missing) |
Drafts, quotations and services never move stock. Goods with Keep Stock off don't either.
Costing: weighted average
Each time stock comes in, the item's average cost in that warehouse is recalculated:
new average = (quantity on hand × old average + quantity in × cost in) ÷ (quantity on hand + quantity in)
Stock going out (sales, subtractions, transfers) leaves at the current average cost, and that value is posted to cost of goods sold. A purchase brings stock in at the line amount after line discount, in the base currency.
Rule 1: no negative stock
You can't take out more than a warehouse holds:
Not enough stock for Item: 3 available in this warehouse, 5 needed.
Buy or move the stock in first, or choose the warehouse (or batch) that has it. Two users can't sell the last unit at the same moment: the second sale is refused.
Rule 2: no back-dating before the last movement
A stock document can't be dated before the item's last stock movement in that warehouse:
Item already has stock movements on 2026-10-04 in this warehouse. A stock document cannot be dated before the item's last movement.
Enter stock documents in date order. If you forgot a purchase from last week and the item has been sold since, date the bill today or use a stock adjustment.
Rule 3: only the latest movement can be undone
Editing or deleting a stock document is refused if the item has later movements, because those were costed on top of it:
Item has a later stock movement (SAI-25, 2026-10-05). This document can no longer be changed or deleted - use a return or a stock adjustment instead.
Correct it with a credit note, a debit note or a stock adjustment instead.
Other stock messages
| Message | Meaning |
|---|---|
| The selected unit is not set up for this item. Add it to the item's units first. | Add the unit under Other Units on the item. |
| Only goods that keep stock can be adjusted / transferred. | Services and goods without Keep Stock have no stock. |
| The same item, variant and batch is listed twice. | Merge the two lines. |
| Enter the cost of X: it has no average cost yet. | The item has never come in; enter a cost on the adjustment line. |
Who sees costs
Average costs and purchase rates are visible only to users with the View Cost permission. See Roles and permissions.
Rebuild Stock
Rebuild Stock on the item list recalculates every item's quantity and average cost from all stock movements. You don't normally need it; use it if a stock figure looks wrong.