mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-01 15:47:06 +00:00
Stock Ageing iterates stock ledger entries through an unbuffered (streaming) cursor. _get_batchwise_valuation() lazily queried Batch.use_batchwise_valuation from inside that loop whenever a row carried the legacy batch_no field, and the nested query invalidated the active streaming result set — crashing the report (or silently dropping the remaining rows, depending on the driver version). Resolve the valuation flags in a single query before entering the unbuffered cursor block; the lazy lookup now only serves callers that pass stock ledger entries in directly, where no streaming is active. Fixes https://github.com/frappe/erpnext/issues/55786 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Inventory management module.