Skip to content

Commit

Permalink
fix: set default party type in Payment Entry
Browse files Browse the repository at this point in the history
  • Loading branch information
vishakhdesai committed Nov 13, 2024
1 parent 1383401 commit 1922269
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions erpnext/accounts/doctype/payment_entry/payment_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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(
[
Expand Down Expand Up @@ -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);
}

0 comments on commit 1922269

Please sign in to comment.