Automatically default party_type based on payment_type in Payment Entry

In case users spend more time selecting the party after selecting the payment_type then you can use below script that helped us improve data entry speed.

frappe.ui.form.on(“Payment Entry”, “payment_type”, function(frm) {
if (cur_frm.doc.payment_type == “Pay”) {
cur_frm.set_value(“party_type”, “Supplier”);
} else if (cur_frm.doc.payment_type == “Receive”) {
cur_frm.set_value(“party_type”, “Customer”);
}
});