Client side custom validation passes but document doesn't get saved

In one of my DocTypes I have a Custom Validation function. When this function is there it does not save the document. However, when I take that portion of code out, the form saves. Could someone please help me resolving this?

No syntax errors in this code. Also I removed the line “frappe.validated = false” and executed the code and it still didn’t save the document. I had to remove the entire customer validation function to get it working. How can I include these kind of validations?

frappe.ui.form.on('Vehicle Test', {
	make: function(frm) {
		//Filter models based on vehicle make
		cur_frm.set_value('model', '');
		cur_frm.fields_dict['model'].get_query = function(doc) {
			return {
				filters: {
					"parent": doc.make
				}
			}
		}
	}
});

cur_frm.cscript.custom_validate = function(doc) {
	//Validate if information are properly filled for offer marked as finalized sale.
	for (var i=0;i<doc.offers.length;i++) {
		if (doc.offers[i].finalized_sale == "1") {
			if ((doc.offers[i].preferred_financial_institute == undefined) && (doc.offers[i].finance_lease_amount > 0)) {
				frappe.msgprint(__("Please set the prefered financial institute for finalized sale in offers."));
				frappe.validated = false;
			}
			else if ((doc.offers[i].preferred_financial_institute.length>0) && (doc.offers[i].finance_lease_amount==0)) {
				frappe.msgprint(__("Please set the expected Finance/Lease amount for finalized sale in offers."));
				frappe.validated = false;
			} 
		}
	}
}