Skip to main content
OptiFlow provides comprehensive inventory management across multiple workspaces with real-time stock tracking, adjustments, and movement history.

Overview

Inventory features include:
  • Multi-workspace stock tracking
  • Automatic stock deductions on sales
  • Manual stock adjustments
  • Stock movement history
  • Minimum stock level alerts
  • Inventory valuation

Product Stock Configuration

Before tracking inventory, products must be configured:

Enabling Stock Tracking

When creating or editing a product:
  1. Navigate to ProductsCreate Product or edit an existing product
  2. Enable Track Stock checkbox
  3. Set Minimum Quantity for low stock alerts (optional)
  4. Set Cost for inventory valuation
// Product model
'track_stock' => 'boolean',  // Enable/disable tracking
'cost' => 'decimal:2',       // Unit cost for valuation
Only products with track_stock = true will have inventory managed. Products without stock tracking can be sold unlimited quantities.

Viewing Stock Levels

Current Stock by Workspace

View real-time stock levels:
  1. Navigate to InventoryStock Levels
  2. Filter by:
    • Workspace (location)
    • Product category
    • Low stock items
    • Product name/SKU
Each product shows:
  • Current quantity per workspace
  • Minimum quantity threshold
  • Stock value (quantity × cost)
  • Available/Reserved quantities

Product-Specific Stock View

  1. Go to Products → Select a product
  2. View the Inventory tab
  3. See stock breakdown by workspace
  4. View recent stock movements
Reference: ProductStock model stores quantity per product per workspace

Stock Movements

All inventory changes are tracked as stock movements:

Movement Types

TypeDescriptionImpact
INStock receivedIncreases quantity
OUTStock sold/removedDecreases quantity
ADJUSTMENTManual correctionIncreases or decreases
TRANSFER_OUTSent to another workspaceDecreases at source
TRANSFER_INReceived from another workspaceIncreases at destination
INITIALInitial stock setupSets starting quantity
Reference: StockMovementType enum in app/Enums/StockMovementType.php

Viewing Stock Movements

1

Navigate to Movement History

Go to InventoryStock Movements
2

Filter Movements

Filter by:
  • Date range
  • Movement type
  • Product
  • Workspace
  • User who created the movement
3

View Movement Details

Each movement shows:
  • Product name and SKU
  • Quantity changed
  • Movement type
  • User who performed the action
  • Timestamp
  • Related document (invoice, transfer, etc.)
  • Notes

Automatic Stock Movements

Stock movements are created automatically when:
  1. Invoice Created: Stock moves OUT for each line item
    • Reference: CreateInvoiceItemAction creates stock movements
    • Type: StockMovementType::OUT
    • Related to invoice
  2. Stock Transfer: Two movements created
    • TRANSFER_OUT at source workspace
    • TRANSFER_IN at destination workspace
    • Both linked by reference_number
// From StockMovement model
public function isIncoming(): bool
{
    return in_array($this->type, ['in', 'adjustment']) && $this->quantity > 0;
}

public function isOutgoing(): bool
{
    return in_array($this->type, ['out', 'transfer']) ||
           ($this->type === 'adjustment' && $this->quantity < 0);
}

Stock Adjustments

Manual inventory corrections for damaged goods, loss, found items, or count corrections.
1

Navigate to Adjustments

Go to InventoryStock AdjustmentsNew AdjustmentReference: ProductInventoryAdjustmentController::create()
2

Select Workspace

Choose the workspace where inventory is being adjusted.The form loads:
  • All workspaces the user has access to
  • All products with stock tracking enabled
  • Current stock levels for each product in each workspace
// Current stock is loaded per product per workspace
$stockMap = ProductStock::query()
    ->whereIn('workspace_id', $workspaceIds)
    ->get()
    ->groupBy('product_id');
3

Add Adjustment Items

For each product being adjusted:
  1. Select Product: Choose from products with stock tracking
  2. Current Stock: System displays current quantity
  3. New Quantity: Enter the corrected quantity
  4. Adjustment: System calculates difference automatically
  5. Reason: Select reason (damaged, lost, found, count correction)
  6. Notes: Add explanation for the adjustment
4

Review and Save

Review the adjustment summary:
  • Total items adjusted
  • Net quantity change
  • Affected workspaces
  • Adjustment value (quantity × product cost)
Click Save Adjustment to commit changes.Reference: CreateProductInventoryAdjustmentAction::handle()

Adjustment Process

When an adjustment is saved:
// ProductInventoryAdjustment creates multiple items
$adjustment = ProductInventoryAdjustment::create([
    'workspace_id' => $workspace->id,
    'adjustment_date' => $data['adjustment_date'],
    'notes' => $data['notes'],
    'created_by' => $user->id,
]);

// For each item:
// 1. Update ProductStock quantity
// 2. Create StockMovement record
// 3. Track the adjustment reason
Stock adjustments directly modify inventory quantities. Ensure adjustments are reviewed and approved according to your internal controls.

Setting Initial Stock

For new products or when starting to use OptiFlow:
1

Navigate to Initial Stock

Go to InventoryInitial StockReference: InitialStockController
2

Select Products and Workspaces

Choose:
  • Products to set initial stock for
  • Workspaces where stock exists
  • Initial quantities per workspace
  • Unit cost for valuation
3

Save Initial Stock

Click Save to create:
  • ProductStock records with initial quantities
  • StockMovement records with type INITIAL
  • Starting inventory valuation
Set initial stock before processing any sales to ensure accurate inventory from the start.

Multi-Workspace Stock Management

OptiFlow supports tracking inventory across multiple locations (workspaces).

Workspace Context

  • Each workspace maintains independent stock levels
  • Users can have access to one or multiple workspaces
  • Inventory reports can be workspace-specific or consolidated

Viewing Stock Across Workspaces

For users with ViewAllLocations permission:
  1. Navigate to InventoryStock by Location
  2. View consolidated stock levels across all workspaces
  3. See stock distribution per location
// ProductInventoryAdjustmentController checks permission
if (! $user->can(Permission::ViewAllLocations)) {
    $workspacesQuery->whereIn('id', $user->workspaces()->select('workspaces.id'));
}

Stock Transfers Between Workspaces

Transfer inventory between locations without creating invoices. See the dedicated guide: Stock Transfers

Inventory Reporting

Available Reports

  1. Stock Valuation Report
    • Total inventory value by workspace
    • Value by product category
    • Cost basis calculation
  2. Stock Movement Report
    • Movements by date range
    • In/Out/Adjustment breakdown
    • Movement trends
  3. Low Stock Report
    • Products below minimum quantity
    • Workspaces affected
    • Reorder recommendations
  4. Stock Aging Report
    • Products by time in inventory
    • Slow-moving items
    • Inventory turnover
Reference: Navigate to ReportsInventory Reports

Low Stock Alerts

Configure automatic alerts for low stock:
1

Set Minimum Quantities

For each product:
  1. Edit the product
  2. Set Minimum Quantity threshold
  3. Save changes
2

View Low Stock Items

Navigate to InventoryLow StockProducts below minimum quantity are highlighted.
3

Configure Notifications (Optional)

Set up automations to send notifications when stock falls below minimum:
  1. Go to SettingsAutomations
  2. Create trigger: “Product Stock Below Minimum”
  3. Add action: “Send Email Notification”
  4. Specify recipients

Stock Count Procedures

Physical Inventory Count

Best practice for periodic stock verification:
1

Export Current Stock

  1. Navigate to InventoryStock Levels
  2. Export to Excel/CSV
  3. Print count sheets
2

Perform Physical Count

Count actual stock on hand and record on sheets
3

Compare and Adjust

  1. Compare physical count to system quantities
  2. Create stock adjustment for discrepancies
  3. Document reasons for variances
4

Review and Approve

Have manager review and approve adjustments before committing

Common Issues

Negative Stock

Problem: System shows negative inventory Solution:
  1. Review stock movements for the product
  2. Identify incorrect transactions
  3. Create stock adjustment to correct
  4. Enable “Prevent Negative Stock” in settings (if available)

Stock Deduction Not Happening

Problem: Invoice created but stock not deducted Solution:
  1. Verify product has track_stock enabled
  2. Check if product has ProductStock record for the workspace
  3. Review stock movement history for the transaction

Incorrect Stock Levels After Transfer

Problem: Stock levels don’t match after workspace transfer Solution:
  1. Navigate to InventoryStock Transfers
  2. Find the transfer record
  3. Verify both TRANSFER_OUT and TRANSFER_IN movements exist
  4. Check the reference numbers match
  5. Create manual adjustment if needed

Best Practices

Regular Stock Counts: Perform physical inventory counts monthly or quarterly to ensure system accuracy.
Set Minimum Quantities: Configure minimum stock levels for all regularly sold items to avoid stockouts.
Document Adjustments: Always add detailed notes to stock adjustments for audit trail purposes.
Review Movement History: Regularly review stock movement reports to identify patterns and potential issues.
Use Categories: Organize products into categories for easier inventory reporting and management.

Build docs developers (and LLMs) love