fix: guard against None row in get_stock_balance_for

row defaults to None but was dereferenced unconditionally when computing
the incoming rate for batch-tracked items, causing an AttributeError for
any caller (e.g. direct API calls) that omits row while still passing
batch_no. The other two row accesses in this function already guard
against None; this brings the incoming-rate check in line with them.
This commit is contained in:
R-Jayaraman
2026-07-28 18:57:06 +05:30
parent 986cea2331
commit f9d25bc3d3

View File

@@ -1547,7 +1547,7 @@ def get_stock_balance_for(
)
serial_nos = "\n".join(d.serial_no for d in serial_no_details if d.batch_no == batch_no)
if row.use_serial_batch_fields and row.batch_no and (qty or row.current_qty):
if row and row.use_serial_batch_fields and row.batch_no and (qty or row.current_qty):
rate = get_incoming_rate(
frappe._dict(
{