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 <noreply@anthropic.com>
This commit is contained in:
Mihir Kandoi
2026-06-10 22:02:37 +05:30
parent 81a1c2c8ce
commit a7d41f24a3

View File

@@ -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 []