I tried use this custom script code
frappe.ui.form.on("Sales Order Item", {
onsubmit: function(frm) {
if(frm.doc.projected_qty < 0){
frappe.msgprint('Warning');
}
}
})
to display warning message to user for stock shortage but it’s not working