Stock Reservation on Production Batch
Most factories run with overlapping batches. Batch A needs 500 metres of indigo denim; Batch B needs 300 of the same. If only 600 metres are on hand, you have a problem — and you want to know about it before both batches try to start, not after one fails mid-cut.
That's what Stock Reservation Entries are for. ERPNext's standard reservation mechanism lets you earmark stock against a specific demand. GarmentFlow extends it so reservations can be made against a Production Batch directly, with reserved/delivered/transferred/consumed quantities flowing back to the Batch's materials table in real time.
What's overridden, and why
ERPNext's standard Stock Reservation Entry accepts vouchers like Sales Order. It doesn't natively know about Production Batches. GarmentFlow registers a CustomStockReservationEntry override (via override_doctype_class in hooks.py) that adds Production Batch as a valid voucher type.
What this enables:
- An SRE can have
voucher_type = "Production Batch"andvoucher_no = <batch name>. - The
voucher_detail_nopoints to a specific row in the Batch's materials table. - When SRE status changes (a transfer happens, an item is consumed, the reservation is released), the override syncs reserved_qty back to the matching
Production Batch Materialrow.
The calculation:
reserved_qty (visible on batch) =
sum across all active SREs for that batch+item:
reserved_qty - delivered_qty - transferred_qty - consumed_qty
The Batch's materials section therefore always shows the net reserved quantity — accounting for what's been transferred out, consumed, or already delivered. This is the number you trust when deciding whether enough material is reserved for the rest of the batch's run.
When reservations happen
Three flows can create an SRE against a Batch:
- Manual reservation — a planner explicitly reserves stock against the Batch from the Stock Reservation Entry form.
- On Batch material allocation — when materials are allocated on a Batch and the inventory allows, GarmentFlow can be configured to create SREs automatically.
- On MR submission — when the auto-created Material Request is submitted, the corresponding stock can be reserved against the Batch.
The right configuration for your factory depends on how tight your inventory is. Tight inventory (no slack, multiple batches competing) → reserve aggressively. Loose inventory → reserve only what matters.
What reservations protect
A reserved quantity is not removed from the warehouse. It's still physically there, still visible in the Stock Balance. But it's promised to a specific Production Batch.
What that buys you:
- Visibility. A planner can ask "how much of this fabric is uncommitted?" by subtracting reserved from on-hand. The answer is meaningful instead of best-guess.
- Allocation discipline. If a second Batch tries to start and would consume reserved stock, GarmentFlow flags it.
- Audit trail. SREs are stamped, signed, and traceable. If a fight breaks out over which Batch had priority, the SRE timeline answers it.
What reservations don't do
Reservations don't physically lock stock. A warehouse user can still post a Stock Entry that moves reserved materials elsewhere. The SRE surfaces the conflict (and the override recomputes the Batch's reserved quantity), but ERPNext doesn't prevent you from breaking your own reservation.
In practice, this means reservations are a contract between the planning and warehouse teams — backed by ERPNext, but ultimately enforced by process.
Reading the Batch's materials section
Open a Production Batch. The Materials section shows, per row:
- Required Qty — what the Batch needs.
- Allocated Qty — what's been allocated against the Batch.
- Reserved Qty — what's actively reserved (the override-maintained number).
- Transferred Qty — what's actually moved into a WIP warehouse via Material Transfer Stock Entries.
- Consumed Qty — what's been consumed via OLE consumption.
Reading left to right tells you the lifecycle of every material on the Batch.
Image: A Production Batch's Materials section showing Required, Allocated, Reserved, Transferred, and Consumed columns across several rows.
What to do next
That closes the conceptual centerpiece. The rest of the section is the practical side: Procurement for inbound, The Logistics App for daily operations.