diff --git a/erpnext/manufacturing/doctype/job_card/job_card.js b/erpnext/manufacturing/doctype/job_card/job_card.js index 034ed8a49af527053cfeee6401bdf7f7711e8d6c..2b2b8313854ef1e0448a235c042b9827b2da66e9 100644 --- a/erpnext/manufacturing/doctype/job_card/job_card.js +++ b/erpnext/manufacturing/doctype/job_card/job_card.js @@ -23,17 +23,35 @@ frappe.ui.form.on('Job Card', { } }); - frm.set_indicator_formatter('sub_operation', - function(doc) { - if (doc.status == "Pending") { - return "red"; - } else { - return doc.status === "Complete" ? "green" : "orange"; - } + frm.events.set_company_filters(frm, "source_warehouse"); + frm.events.set_company_filters(frm, "wip_warehouse"); + frm.set_query("source_warehouse", "items", () => { + return { + filters: { + company: frm.doc.company, + }, + }; + }); + + frm.set_indicator_formatter("sub_operation", function (doc) { + if (doc.status == "Pending") { + return "red"; + } else { + return doc.status === "Complete" ? "green" : "orange"; } ); }, + set_company_filters(frm, fieldname) { + frm.set_query(fieldname, () => { + return { + filters: { + company: frm.doc.company, + }, + }; + }); + }, + make_fields_read_only(frm) { if (frm.doc.docstatus === 1) { frm.set_df_property("employee", "read_only", 1);