What is wrong with following code. I am trying to get user confirmation if the payment entry is duplicate on same date?
frappe.ui.form.on("Payment Entry", "validate", (frm) =>{
if(frm.doc.status !="Cancelled"){
frappe.call({
method: "frappe.client.get_value",
args: {
"doctype": "Payment Entry",
"filters": {"party_name": frm.doc.party, "posting_date": frm.doc.posting_date},
"fieldname": 'party_name'
},
callback: async function(data) {
if(!$.isEmptyObject(data.message))
await showConfirmationDialog();
}
});
}
});
function showConfirmationDialog(){
return new Promise((resolve,reject) => {
frappe.confirm(
'The Payment on same date already exist.Do you want to continue?',
() => resolve(),
() => reject("frappe.validated = false")
);
});
}