Skip to main content

Introduction

The SushiGo inventory system is designed to manage stock across multiple locations within operating units (branches and events). It provides complete traceability of all movements, supports multiple units of measure with conversions, and maintains weighted average costing for profitability analysis.
The inventory system is built for scalability—from a single branch to multiple locations, and from permanent stores to temporary event inventories.

Architecture Overview

Core Entities

The inventory system is built around these key entities:

Items & Variants

Master catalog of products, supplies, and assets with multiple variants per item

Inventory Locations

Physical or logical zones within each operating unit (MAIN, KITCHEN, BAR, etc.)

Stock Records

Current quantities per variant per location with on_hand, reserved, and available

Stock Movements

Complete audit trail of all inventory transactions with reason codes

Inventory Hierarchy

1

Branch Level

Physical or administrative branch (e.g., “SushiGo Centro”)
2

Operating Unit Level

Operational context within a branch:
  • BRANCH_MAIN - Permanent branch inventory
  • EVENT_TEMP - Temporary event inventory
3

Location Level

Physical zones within the unit (MAIN, KITCHEN, BAR, RETURN, WASTE)
4

Stock Level

Quantity tracking per variant per location

Item Types

SushiGo supports three item types, each with specific characteristics:

INSUMO (Supply/Input)

Raw materials and supplies used in production or service.
type
enum
default:"INSUMO"
  • Supports multiple unit conversions (e.g., kg → g, box → unit)
  • Track lot numbers and serial numbers (optional)
  • Perishable flag for expiration tracking
Examples: Rice (kg), Soy Sauce (L), Nori Sheets (pack), Salmon (kg)

PRODUCTO (Finished Product)

Finished goods ready for sale to customers.
type
enum
default:"PRODUCTO"
  • Base unit only (1:1 conversion)
  • Sale price tracking
  • Can be manufactured from INSUMOs
Examples: California Roll (unit), Sushi Combo (set), Ramen Bowl (unit)

ACTIVO (Asset)

Physical assets used in operations (furniture, equipment, tools).
type
enum
default:"ACTIVO"
  • Base unit only (1:1 conversion)
  • Serial number tracking recommended
  • Depreciation tracking (future)
Examples: Rice Cooker (unit), Table (unit), Knife Set (set)

Stock Tracking

Stock States

Each variant at each location has three quantity fields:
on_hand
decimal(4)
Physical quantity present at the location
reserved
decimal(4)
Quantity reserved for pending orders or transfers
available
decimal(4)
Computed field: on_hand - reserved (available for sale/transfer)

Cost Tracking

weighted_avg_cost
decimal(4)
Weighted average cost per base unit, updated on each receipt
last_unit_cost
decimal(4)
Most recent purchase cost (tracked at variant level)
Cost updates only occur on OPENING_BALANCE and purchase receipt movements. Sales and transfers use the current weighted average.

Movement Reasons

All stock changes are recorded as StockMovement records with a reason code:
ReasonDirectionDescription
OPENING_BALANCEINInitial stock registration
TRANSFERBOTHInter-location or inter-branch transfer
RETURNBOTHReturn from customer or location
SALEOUTSale to customer (decreases stock)
CONSUMPTIONOUTInternal consumption (meals, samples, spoilage)
ADJUSTMENTIN/OUTManual adjustment (count variance)
COUNT_VARIANCEIN/OUTAdjustment from physical count

Design Principles

Complete Traceability

Every movement records user, timestamp, reason, and optional reference

Multi-UOM Support

Convert between units automatically (kg ↔ g, box ↔ unit)

Location Segregation

Each location maintains separate stock with transfer tracking

Weighted Costing

Automatic cost updates for profitability analysis

Key Workflows

1. Opening Balance Registration

1

Select Location & Variant

Choose inventory location and item variant
2

Enter Quantity & UOM

Enter quantity in any valid unit of measure
3

Optional: Enter Cost

Provide unit cost for cost tracking
4

Post Movement

System converts to base UOM and updates stock + weighted average

2. Stock Out (Sale or Consumption)

1

Select Source Location

Choose location to withdraw from (e.g., KITCHEN)
2

Enter Quantity & Reason

Specify quantity and reason (SALE or CONSUMPTION)
3

Validate Availability

System checks available stock >= requested quantity
4

Post Movement

Stock decreases, cost is recorded for profitability tracking

3. Inter-Location Transfer

1

Select Source & Target

Choose from_location and to_location
2

Enter Quantity

Specify quantity to transfer (with UOM conversion)
3

Validate Availability

System ensures source has sufficient available stock
4

Post Movement

Stock decreases at source, increases at target atomically

Data Model Reference

Item Fields

FieldTypeRequiredDescription
skustring(100)YesUnique SKU code (auto-uppercase)
namestring(255)YesItem name
descriptiontextNoDetailed description
typeenumYesINSUMO, PRODUCTO, or ACTIVO
is_stockedbooleanNoTrack in inventory (default: true)
is_perishablebooleanNoHas expiration date (default: false)
is_activebooleanNoActive status (default: true)

ItemVariant Fields

FieldTypeRequiredDescription
item_idintegerYesParent item ID
uom_idintegerYesBase unit of measure
codestring(100)YesUnique variant code
barcodestring(50)NoProduct barcode (EAN/UPC)
namestring(255)YesVariant name
track_lotbooleanNoTrack lot numbers (default: false)
track_serialbooleanNoTrack serial numbers (default: false)
sale_pricedecimal(4)NoDefault sale price
min_stockdecimal(4)NoMinimum stock level
max_stockdecimal(4)NoMaximum stock level

Stock Fields

FieldTypeDescription
inventory_location_idintegerLocation where stock is held
item_variant_idintegerVariant being tracked
on_handdecimal(4)Physical quantity on hand
reserveddecimal(4)Quantity reserved
availabledecimal(4)Computed: on_hand - reserved
weighted_avg_costdecimal(4)Current average cost per unit

StockMovement Fields

FieldTypeDescription
from_location_idintegerSource location (null for entries)
to_location_idintegerTarget location (null for exits)
item_variant_idintegerVariant being moved
user_idintegerUser who created movement
qtydecimal(4)Quantity in base UOM
reasonenumMovement reason code
statusenumDRAFT, POSTED, or REVERSED
referencestring(100)External reference number
notestextAdditional notes
metajsonbOriginal qty/uom, cost, etc.
posted_attimestampWhen movement was posted

Next Steps

Items & Variants

Create and manage items and their variants

Inventory Locations

Configure locations within operating units

Stock Movements

Record opening balances, transfers, and adjustments

Unit Conversions

Set up unit of measure conversions

Build docs developers (and LLMs) love