Hello Everyone!
I have an issue with my script. Script runs well but the Supplier Quotation doctype get saved after showing the message and a number get generated, I want if there is supplier and supplier part number mentioned in the item master against that item (mentioned in the supplier quotation) it doesn’t allow to save the supplier quotation and even doesn’t generate any docnumber.
frappe.ui.form.on("Supplier Quotation", "validate", function(frm, doctype, name) {
var i;
$.each(cur_frm.doc.items, function(j, item) {
var d1 =
{
"item_code": item.item_code,
"supplier": frm.doc.supplier
};
frappe.call
({
method: "library.supplier_quotation.get_supplier_from_item_master",
args: d1,
freeze: true,
freeze_message: "Please wait ..",
callback: function(r)
{
if(!r.message)
{
frappe.msgprint("Can't save Supplier Part Number is missing for "+item.item_code);
frappe.validated=false;
}
}
});
});
});