Feature #12359
openImplement Product Stock Assignment to Locations and Preorder Stock Allocation
Files
Subtasks
Related issues
Updated by Pavan Kumar Murala 1 day ago
- File Product_Stock_and_Preorder_Flow_Guide (1).docx Product_Stock_and_Preorder_Flow_Guide (1).docx added
- Status changed from New to In Progress
1. Objective
Implement a stock management flow that allows administrators to:
Add product stock directly to any location.
View product stock availability across all locations.
Select one or multiple locations when creating a preorder.
Allocate available location stock to preorder stock.
Automatically update stock quantities after allocation.
2. Business Requirements
A. Location Management
The system supports three location types:
Warehouse
Store
Pickup Location
Important business rule:
These three location types are independent. There is no parent-child relationship or automatic stock connection between them.
Stock can be added directly to any location. Each location maintains its own stock quantity.
B. Add Product Stock to a Location
Business flow:
Admin selects a product.
Admin selects a location.
Admin enters the stock quantity.
System saves the stock against the selected product and location.
The location's available stock is updated.
Example:
Product
Location
Added Stock
Rice
Warehouse
100
Rice
Store
40
Rice
Pickup Location
15
Total available stock = 155 bags.
Each location maintains its own independent stock balance.
C. Create Preorder and Allocate Stock
Business flow:
Admin starts creating a preorder.
Admin selects a product.
System displays all locations where the selected product has available stock.
Admin selects one or multiple locations.
Admin enters the quantity to allocate from each location.
System validates the requested quantities.
System transfers the allocated quantity from location stock to preorder stock.
System displays the total allocated preorder quantity.
Example:
Selected product: Rice
Location
Available Stock
Preorder Allocation
Warehouse
100
20
Store
40
10
Pickup Location
15
0
Total
155
30
D. Stock Update After Preorder Allocation
After allocating 30 bags:
Location / Stock Type
Before
After
Warehouse
100
80
Store
40
30
Pickup Location
15
15
Preorder Stock
0
30
Important: Allocated stock must be deducted from the source location. The same quantity must not remain available in both location stock and preorder stock.
3. Developer Implementation Flow
Step 1: Product Stock Assignment
Implement product and location selection.
Support Warehouse, Store and Pickup Location.
Allow stock quantity entry.
Save stock against the selected product and location.
Update the existing location stock quantity when additional stock is added, according to the inventory rules.
Step 2: Location-Wise Stock Retrieval
When a product is selected during preorder creation, retrieve its stock across all locations.
Display location name, location type and available quantity.
Show only locations with available stock greater than zero for allocation.
Step 3: Preorder Stock Allocation
Allow the admin to select one or multiple locations.
Accept the allocation quantity for each selected location.
Validate that the allocation quantity is greater than zero.
Validate that the allocation does not exceed the selected location's available stock.
Calculate the total preorder allocation.
Step 4: Stock Transfer and Update
Deduct the allocated quantity from each selected location.
Add the combined allocated quantity to preorder stock for the selected product.
Save the allocation details for tracking.
Ensure source stock and preorder stock are updated consistently.
Use a database transaction or equivalent atomic operation to prevent partial stock updates.
Step 5: Validation and Error Handling
Prevent allocation when available stock is insufficient.
Prevent negative stock quantities.
Prevent duplicate or concurrent allocations from exceeding available stock.
Ensure failed allocations do not leave partially updated stock balances.
Display a clear success or error message.