From d0b98d74de7727380500ac1fbfda97baf93f21a1 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Sat, 30 Mar 2019 19:44:31 +0530 Subject: [PATCH] fix: Allow doctype only in party account types --- erpnext/accounts/doctype/payment_entry/payment_entry.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index 30ae54b18b..5707d154c1 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -232,6 +232,13 @@ frappe.ui.form.on('Payment Entry', { }, party_type: function(frm) { + + let party_types = Object.keys(frappe.boot.party_account_types); + if(frm.doc.party_type && !party_types.includes(frm.doc.party_type)){ + frm.set_value("party_type", ""); + frappe.throw(__("Party can only be one of "+ party_types.join(", "))); + } + if(frm.doc.party) { $.each(["party", "party_balance", "paid_from", "paid_to", "paid_from_account_currency", "paid_from_account_balance",