Inventory Domain
Storeharmony’s inventory system is a layered domain — not a simple stock counter. It supports offline-first retail, batch-aware costing, per-location quantity control, complete stock movement traceability, purchasing, reservations, transfers, production, and reconciliation.
Core Principle
Inventory is not a single number on a product. It is represented through a hierarchy of increasingly detailed records:
- Product definition – The base item (name, category, SKU)
- Variant / sellable item – Size, color, unit, barcode
- Per-location quantity – Stock split across physical stores or warehouses
- Batch-level stock – Individual batches with cost price, expiry, receipt date
- Stock movement history – Every in/out recorded with reason, source, and destination
Key Entities
| Entity | Purpose |
|---|---|
ShopItem | Sellable variant – tracks stock per location, cost, price, supplier |
InventoryTemplate | Product definition – the base item parents share |
ItemType | Category/taxonomy node in the product tree |
HumanType | Logical grouping (e.g. “Proteins”, “Beverages”) |
ItemColor / ItemSize | Variant dimensions |
ItemLabel | Custom tags/labels for filtering |
NewStockPack | Batch stock-in record (supplier receipt, cost, quantity) |
Supplier | Vendor profiles with payment terms |
InventoryContainer | Physical store/warehouse location |
Promotion | Discount rules and campaigns |
ItemGrouping | Composition (kits/bundles) |
Stock Movement Rules
- All stock movements use
DeductStockFromBatchOperation— the single authoritative path for deduction. No operation should directly modify batch quantities. - Stock deduction follows FIFO or FEFO strategy configurable per item category.
- Each movement records: source location, destination, batch reference, quantity, unit cost, timestamp, user, and reason.
- Stock reconciliation is done via physical audit counts with variance tracking.