fix: check if item is variant when creating WO from MR

This commit is contained in:
Mihir Kandoi
2025-12-10 16:53:02 +05:30
parent 85114eda7c
commit 0bec419301

View File

@@ -845,7 +845,10 @@ def raise_work_orders(material_request, company):
for d in mr.items:
if (d.stock_qty - d.ordered_qty) > 0:
if frappe.db.exists("BOM", {"item": d.item_code, "is_default": 1}):
if frappe.db.exists("BOM", {"item": d.item_code, "is_default": 1}) or (
(variant_of := frappe.get_value("Item", d.item_code, "variant_of"))
and frappe.db.exists("BOM", {"item": variant_of, "is_default": 1, "is_active": 1})
):
wo_order = frappe.new_doc("Work Order")
wo_order.update(
{