fix: pass finished goods as list to subcontracting BOM lookup

set_service_items_for_finished_goods built a set and passed it to
get_subcontracting_boms_for_finished_goods, whose filter builder only
handles str and list. Whitelist type validation lax-coerces the set to a
list during HTTP requests and tests, hiding the mismatch, but from
console, bench execute or background contexts the set reaches
frappe.get_all verbatim and is inlined into invalid SQL on both MariaDB
and PostgreSQL.

Ref #57996
This commit is contained in:
Mihir Kandoi
2026-08-11 12:41:47 +05:30
parent fe8bedef93
commit 40fc6c8b8a

View File

@@ -51,9 +51,9 @@ class SubcontractingService:
if not doc.is_subcontracted:
return
finished_goods_without_service_item = {
d.fg_item for d in doc.items if (not d.item_code and d.fg_item)
}
finished_goods_without_service_item = list(
{d.fg_item for d in doc.items if (not d.item_code and d.fg_item)}
)
if subcontracting_boms := get_subcontracting_boms_for_finished_goods(
finished_goods_without_service_item