From a7d41f24a39227b7da72e647087f0377823433a5 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Wed, 10 Jun 2026 22:02:37 +0530 Subject: [PATCH] fix(stock): don't KeyError when neither bundle nor item_code is passed row is a plain dict subclass, so row["item_code"] raised an unhandled KeyError (500) when the payload had neither key. get_active_product_bundle already returns None for falsy input, yielding an empty item list. Co-Authored-By: Claude Fable 5 --- erpnext/stock/doctype/packed_item/packed_item.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py index d17928bc361..7dbeb109c59 100644 --- a/erpnext/stock/doctype/packed_item/packed_item.py +++ b/erpnext/stock/doctype/packed_item/packed_item.py @@ -454,7 +454,7 @@ def get_items_from_product_bundle(row: str): frappe.bold(bundle_name) ) ) - elif bundle_name := get_active_product_bundle(row["item_code"]): + elif bundle_name := get_active_product_bundle(row.get("item_code")): frappe.has_permission("Product Bundle", "read", bundle_name, throw=True) bundled_items = get_product_bundle_items_by_name(bundle_name) if bundle_name else []