fix: set default party type in Payment Entry
(cherry picked from commit 19222690d3)
This commit is contained in:
@@ -26,6 +26,10 @@ frappe.ui.form.on("Payment Entry", {
|
||||
}
|
||||
|
||||
erpnext.accounts.dimensions.setup_dimension_filters(frm, frm.doctype);
|
||||
|
||||
if (frm.is_new()) {
|
||||
set_default_party_type(frm);
|
||||
}
|
||||
},
|
||||
|
||||
setup: function (frm) {
|
||||
@@ -403,6 +407,8 @@ frappe.ui.form.on("Payment Entry", {
|
||||
},
|
||||
|
||||
payment_type: function (frm) {
|
||||
set_default_party_type(frm);
|
||||
|
||||
if (frm.doc.payment_type == "Internal Transfer") {
|
||||
$.each(
|
||||
[
|
||||
@@ -1776,3 +1782,16 @@ frappe.ui.form.on("Payment Entry Deduction", {
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
},
|
||||
});
|
||||
|
||||
function set_default_party_type(frm) {
|
||||
if (frm.doc.party) return;
|
||||
|
||||
let party_type;
|
||||
if (frm.doc.payment_type == "Receive") {
|
||||
party_type = "Customer";
|
||||
} else if (frm.doc.payment_type == "Pay") {
|
||||
party_type = "Supplier";
|
||||
}
|
||||
|
||||
if (party_type) frm.set_value("party_type", party_type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user