From 40fc6c8b8a7dee0f0b018b5015669d9ea64505d1 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 11 Aug 2026 12:41:47 +0530 Subject: [PATCH] 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 --- .../doctype/purchase_order/services/subcontracting.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/services/subcontracting.py b/erpnext/buying/doctype/purchase_order/services/subcontracting.py index e9f6083f4b7..a9b2aabee38 100644 --- a/erpnext/buying/doctype/purchase_order/services/subcontracting.py +++ b/erpnext/buying/doctype/purchase_order/services/subcontracting.py @@ -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