Support #12265
openSupport #12257: Vendor Management flow Issues
Customer Quotations Reserve Product Quantity but Ignore Stock Batches
0%
Description
Code Location: quotationStockAllocation.service.js:L78-L140
What is happening in code: When a sales quote is created for a large corporate customer (e.g. landscaping company), the system reserves stock by updating product.stockAllocations or product.reservedQuantity. However, it never reserves any specific StockBatch.
Real-Life Example:
You have 10 specialty palm trees in stock (all belonging to Batch #PALM-1, costing $100 each).
A commercial client requests a quote for all 10 palm trees. You issue the quote, and the system reserves 10 palm trees.
In the afternoon, a walk-in retail customer buys 4 palm trees at the POS counter.
The POS register runs consumeStockBatchService, which doesn't check quotation allocations and consumes 4 trees from Batch #PALM-1.
Next day, the commercial client accepts the quote and pays for 10 trees.
What breaks: When warehouse staff go to fulfill the quote, only 6 trees are left. The reserved stock was sold out from under the client!
Business Impact: You promised inventory to a client, took payment, and now cannot fulfill the order because the batch was sold at the counter.
Simple Fix:
When allocating quotation stock, also flag qtyReserved on the specific StockBatch documents.
In consumeStockBatchService, ensure walk-in sales can only consume qtyRemaining - qtyReserved.
Subtasks
Related issues
No data to display