Inventory Domain Reference

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:

  1. Product definition – The base item (name, category, SKU)
  2. Variant / sellable item – Size, color, unit, barcode
  3. Per-location quantity – Stock split across physical stores or warehouses
  4. Batch-level stock – Individual batches with cost price, expiry, receipt date
  5. Stock movement history – Every in/out recorded with reason, source, and destination

Key Entities

EntityPurpose
ShopItemSellable variant – tracks stock per location, cost, price, supplier
InventoryTemplateProduct definition – the base item parents share
ItemTypeCategory/taxonomy node in the product tree
HumanTypeLogical grouping (e.g. “Proteins”, “Beverages”)
ItemColor / ItemSizeVariant dimensions
ItemLabelCustom tags/labels for filtering
NewStockPackBatch stock-in record (supplier receipt, cost, quantity)
SupplierVendor profiles with payment terms
InventoryContainerPhysical store/warehouse location
PromotionDiscount rules and campaigns
ItemGroupingComposition (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.