Issue with Supplier Quotation Custom Script

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;
	}
	}
	});
});
});

Any idea what I am missing?

Regards
Ruchin Sharma

Remove :
frappe.validated=false;

Add :

validated=false;
return false;

@shahid
I have updated the code but its still not working.

@ruchin78 can you share your code?

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);
	validated=false;
	return false;
	}
	}
	});
});
});

@ruchin78
why using !r.message?

Try to use without ! clause.

	if(r.message) 
	{
	frappe.msgprint("Can't save Supplier Part Number is missing for "+item.item_code);
	validated=false;
	return false;
	}

Because I want to run the statement when the return value is 0 (false).

Are you sure r.message is returning 0?