Skip to content

Add Serial / Batch wise view to Stock Balance report #56641

Description

@abhas-k

Feature request

Summary

Add an optional Serial / Batch wise breakdown to the Stock Balance report so users can see closing stock quantity and valuation per serial number or batch — without running the full Stock Ledger report.

Problem

Today, Stock Balance groups stock only by Item + Warehouse (plus optional inventory dimensions). It answers: "How much of this item do I have in this warehouse?"

For batch-tracked or serial-tracked items, operations teams often need: "How much of each batch/serial is on hand, and what is it worth?"

The current options are:

Report What it shows Limitation
Stock Balance Item + Warehouse balances No serial/batch breakdown
Stock Ledger (with Segregate Serial / Batch Bundle) Transaction-level ledger with serial/batch rows Very slow on large datasets; replays every SLE
Available Batch Report Current available qty per batch Does not include non-batch data, cant view total stock
Batch Wise Balance History Batch-level opening/in/out/balance Very slow; Batch only; separate report; no serial support
Serial and Batch Summary Bundle-level transaction listing Transaction-oriented, not a balance snapshot

On sites with high transaction volume, generating Stock Ledger with serial/batch segregation is extremely slow. Users are forced to choose between performance (Stock Balance) and granularity (Stock Ledger).

Use case

Manufacturing / packaging companies (e.g. food, pharma, flexible packaging) that:

  • Track raw materials and finished goods by batch
  • Need period-wise opening, inward, outward, and closing balances at batch level
  • Run Stock Balance regularly for operations but must fall back to Stock Ledger for batch-level checks

Proposed solution

Add a filter to Stock Balance, similar to Stock Ledger's existing option:

☐ Show Serial / Batch wise stock

When enabled:

  1. Extend grouping from (item_code, warehouse) to (item_code, warehouse, batch_no) and/or (item_code, warehouse, serial_no) depending on item tracking settings.
  2. Show additional columns:
    • Batch No (Link → Batch) — for batch-tracked items
    • Serial No (Link → Serial No) — for serial-tracked items (optional / phase 2)
  3. Preserve existing Stock Balance columns: Opening Qty, In Qty, Out Qty, Balance Qty, Valuation Rate, Balance Value, etc.
  4. Reuse Serial and Batch Bundle / FIFOSlots data paths already used when Show Stock Ageing Data is enabled, rather than replaying the full Stock Ledger row-by-row.

Suggested filters (optional)

Filter Type Purpose
show_serial_batch_wise Check Enable serial/batch breakdown
batch_no Link → Batch Narrow to a specific batch
group_by Select: Batch / Serial Choose breakdown dimension

Expected behaviour

Without the filter (default): Current behaviour unchanged — one row per item per warehouse.

With the filter enabled:

Item Warehouse Batch No Opening Qty In Qty Out Qty Bal Qty Val Rate Bal Value
Rice 5Kg P1 Floor BATCH-001 100 50 30 120 192.50 23,100
Rice 5Kg P1 Floor BATCH-002 0 200 80 120 195.00 23,400

Benefits

  • Performance: Balance snapshot approach instead of full ledger replay
  • Consistency: Same report users already rely on for stock checks
  • Parity: Aligns with Stock Ledger's segregate_serial_batch_bundle concept but optimized for balance reporting
  • Existing infrastructure: Serial and Batch Bundle, FIFOSlots, and batch valuation logic are already in the codebase

Alternatives considered

  1. Use Batch Wise Balance History — Batch only, different column layout, no serial support, requires users to learn a separate report.
  2. Optimize Stock Ledger — Still transaction-oriented; does not solve the need for a fast balance snapshot at batch level.
  3. Use Available Batch Report — Shows current availability only; lacks period opening/in/out columns that Stock Balance provides.

Module

stock

Version

ERPNext version-15


Additional context

Stock Ledger already supports this pattern via the Segregate Serial / Batch Bundle checkbox (stock_ledger.js, segregate_serial_batch_bundle). The request is to bring an equivalent capability to Stock Balance, which is the preferred report for day-to-day balance checks due to its speed.

Example workflow today:

  1. User runs Stock Balance → fast, but no batch detail
  2. User clicks View Stock Ledger from Stock Balance → slow, especially with serial/batch segregation
  3. User waits for Prepared Report or times out

Desired workflow:

  1. User enables Show Serial / Batch wise stock on Stock Balance
  2. User gets batch-level balances in one fast report

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions