Merge pull request #46782 from iamkhanraheel/fix-customer-payment-autofetch

fix: fetch customer related data in making payment entry from customer
This commit is contained in:
ruthra kumar
2025-04-14 17:32:49 +05:30
committed by GitHub
2 changed files with 31 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ frappe.ui.form.on("Customer", {
Quotation: "Quotation",
"Sales Order": "Sales Order",
"Pricing Rule": "Pricing Rule",
"Payment Entry": "Payment Entry",
};
frm.make_methods = {
Quotation: () =>
@@ -26,6 +27,11 @@ frappe.ui.form.on("Customer", {
method: "erpnext.selling.doctype.customer.customer.make_opportunity",
frm: frm,
}),
"Payment Entry": () =>
frappe.model.open_mapped_doc({
method: "erpnext.selling.doctype.customer.customer.make_payment_entry",
frm: frm,
}),
"Pricing Rule": () => erpnext.utils.make_pricing_rule(frm.doc.doctype, frm.doc.name),
};

View File

@@ -438,6 +438,31 @@ def make_opportunity(source_name, target_doc=None):
return target_doc
@frappe.whitelist()
def make_payment_entry(source_name, target_doc=None):
def set_missing_values(source, target):
_set_missing_values(source, target)
target_doc = get_mapped_doc(
"Customer",
source_name,
{
"Customer": {
"doctype": "Payment Entry",
"field_map": {
"name": "party",
},
}
},
target_doc,
set_missing_values,
)
target_doc.party_type = "Customer"
target_doc.party_name = target_doc.party
return target_doc
def _set_missing_values(source, target):
address = frappe.get_all(
"Dynamic Link",