minor: show BOM related operations (#19237)

This commit is contained in:
rohitwaghchaure 2019-10-03 11:41:36 +05:30 committed by Nabin Hait
parent be8f6f0d65
commit f4245a2d9c
2 changed files with 17 additions and 0 deletions

View File

@ -91,6 +91,16 @@ frappe.ui.form.on("Work Order", {
};
});
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"; });

View File

@ -543,6 +543,13 @@ class WorkOrder(Document):
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("""