Overview
OptiFlow provides comprehensive inventory management with real-time stock tracking, automated movement recording, and multi-workspace support. The system automatically updates inventory when invoices are created and provides detailed stock movement history.Inventory is tracked at the workspace level, allowing the same product to have different stock quantities across multiple locations or business units.
Key Features
Real-Time Tracking
Stock levels update automatically when invoices are created, ensuring accurate inventory counts at all times.
Movement History
Complete audit trail of all stock movements including sales, purchases, adjustments, and transfers.
Multi-Workspace
Track inventory separately for each workspace with support for inter-workspace transfers.
Low Stock Alerts
Monitor stock levels against minimum thresholds and identify products that need reordering.
Stock Records
ProductStock Model
Each product has a stock record per workspace:Stock Properties
- Product: The product being tracked
- Workspace: Location/workspace where stock is held
- Quantity: Current stock level (decimal for fractional units)
- Minimum Quantity: Reorder threshold for low stock alerts
- Supplier: Optional primary supplier for this stock
Stock Operations
Checking Stock Levels
Updating Stock
Stock Movements
Movement Types
OptiFlow tracks all inventory movements:- Incoming
- Outgoing
- Transfers
Stock additions to inventory:
- Purchase/Receipt: Stock received from suppliers
- Adjustment (positive): Inventory count corrections
- Transfer In: Stock received from another workspace
Recording Movements
Movement Properties
- Type: Movement type (in, out, adjustment, transfer)
- Quantity: Amount moved (always positive)
- Unit Cost: Cost per unit (for purchases)
- Total Cost: Total value of movement
- Related Invoice: Invoice that triggered the movement
- User: Who performed the action
- Reference Number: External reference (PO, transfer number)
- Note: Additional context
- From/To Workspace: For transfers between locations
Automatic Movements
Stock movements are automatically created when:- Invoice Created: Decreases stock for sold items
- Invoice Deleted: Returns stock to inventory
- Manual Adjustments: Explicit inventory corrections
Querying Inventory
Find Low Stock Products
Check Stock Availability
Movement History
Movement Attributes
Workspace Transfers
Transfer stock between workspaces:Transfers require corresponding movements in both the source and destination workspaces to maintain accurate inventory counts.
Supplier Management
Track primary suppliers for stock:Reporting & Analytics
Stock Valuation
Movement Reports
Use Cases
Multi-Location Retail
Multi-Location Retail
Track inventory separately for each store location, transfer stock between locations, and monitor which products need reordering at each site.
Warehouse Management
Warehouse Management
Monitor stock levels across multiple warehouses, track incoming shipments from suppliers, and fulfill orders from the appropriate location.
Stock Audits
Stock Audits
Use the adjustment movement type to correct discrepancies found during physical inventory counts.
Supplier Performance
Supplier Performance
Track which suppliers provide stock for different products and analyze delivery history through movement records.
Best Practices
Set Minimum Quantities
Configure appropriate minimum stock levels for each product to receive timely low stock alerts.
Document Movements
Always include notes and reference numbers on manual stock movements for clear audit trails.
Regular Reconciliation
Periodically verify physical stock counts match system records and use adjustments to correct discrepancies.
Track Costs
Record unit costs on incoming movements to support accurate inventory valuation and COGS calculations.
API Reference
ProductStock Methods
isLow()- Check if stock is at or below minimumisSufficient(float $qty)- Check if sufficient quantity availableincrementStock(float $qty)- Add to stockdecrementStock(float $qty)- Remove from stockproduct()- Relationship to Productsupplier()- Relationship to Contact (supplier)
app/Models/ProductStock.php:1
StockMovement Methods
isIncoming()- Check if movement adds stockisOutgoing()- Check if movement removes stockproduct()- Relationship to ProductrelatedDocument()- Relationship to InvoicefromWorkspace()- Source workspace for transferstoWorkspace()- Destination workspace for transferscreatedBy()- Relationship to User
app/Models/StockMovement.php:1