fix: key-error for COGS By Item Group report (backport #47914) (#47916)

fix: key-error for COGS By Item Group report (#47914)

fix: keyerror for COGS By Item Group report
(cherry picked from commit 997ce4eaa7)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
mergify[bot]
2025-06-05 17:18:22 +05:30
committed by GitHub
parent c9eeca22f5
commit f5ef376486

View File

@@ -159,10 +159,11 @@ def assign_item_groups_to_svd_list(svd_list: SVDList) -> None:
def get_item_groups_map(svd_list: SVDList) -> dict[str, str]:
item_codes = set(i["item_code"] for i in svd_list)
ig_list = frappe.get_list(
"Item", fields=["item_code", "item_group"], filters=[("item_code", "in", item_codes)]
return frappe._dict(
frappe.get_all(
"Item", fields=["name", "item_group"], filters=[("name", "in", item_codes)], as_list=True
)
)
return {i["item_code"]: i["item_group"] for i in ig_list}
def get_item_groups_dict() -> ItemGroupsDict: