minor: show BOM related operations (#19237)
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js
index 96e44c8..1789a1f 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.js
+++ b/erpnext/manufacturing/doctype/work_order/work_order.js
@@ -91,6 +91,16 @@
};
});
+ frm.set_query("operation", "required_items", function() {
+ return {
+ query: "erpnext.manufacturing.doctype.work_order.work_order.get_bom_operations",
+ filters: {
+ 'parent': frm.doc.bom_no,
+ 'parenttype': 'BOM'
+ }
+ };
+ });
+
// formatter for work order operation
frm.set_indicator_formatter('operation',
function(doc) { return (frm.doc.qty==doc.completed_qty) ? "green" : "orange"; });
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py
index 24b798b..678e709 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/work_order.py
@@ -543,6 +543,13 @@
bom.set_bom_material_details()
return bom
+def get_bom_operations(doctype, txt, searchfield, start, page_len, filters):
+ if txt:
+ filters['operation'] = ('like', '%%%s%%' % txt)
+
+ return frappe.get_all('BOM Operation',
+ filters = filters, fields = ['operation'], as_list=1)
+
@frappe.whitelist()
def get_item_details(item, project = None):
res = frappe.db.sql("""