Merge pull request #9699 from manassolanki/productn

frappe call only when there is item in production order
This commit is contained in:
Nabin Hait
2017-07-07 15:48:37 +05:30
committed by GitHub

View File

@@ -151,26 +151,28 @@ frappe.ui.form.on("Production Order", {
}, },
production_item: function(frm) { production_item: function(frm) {
frappe.call({ if (frm.doc.production_item) {
method: "erpnext.manufacturing.doctype.production_order.production_order.get_item_details", frappe.call({
args: { method: "erpnext.manufacturing.doctype.production_order.production_order.get_item_details",
item: frm.doc.production_item, args: {
project: frm.doc.project item: frm.doc.production_item,
}, project: frm.doc.project
callback: function(r) { },
if(r.message) { callback: function(r) {
erpnext.in_production_item_onchange = true; if(r.message) {
$.each(["description", "stock_uom", "project", "bom_no"], function(i, field) { erpnext.in_production_item_onchange = true;
frm.set_value(field, r.message[field]); $.each(["description", "stock_uom", "project", "bom_no"], function(i, field) {
}); frm.set_value(field, r.message[field]);
});
if(r.message["set_scrap_wh_mandatory"]){ if(r.message["set_scrap_wh_mandatory"]){
frm.toggle_reqd("scrap_warehouse", true); frm.toggle_reqd("scrap_warehouse", true);
}
erpnext.in_production_item_onchange = false;
} }
erpnext.in_production_item_onchange = false;
} }
} });
}); }
}, },
project: function(frm) { project: function(frm) {