Hi
I given Payment Entry Button in Customer Dashboard and want fetch Customer Name in Payment Entry.
Please Help!
To add to dashboard (use setup event
):
var dashboard = frm.meta.__dashboard;
dashboard.transactions.find(x => x.label === 'Orders').items.push('Payment Entry');
To attach make function (use setup
event):
frm.custom_make_buttons = {
'Payment Entry': 'Payment Entry'
}
Make function (use refresh
event):
if (doc.docstatus==1) {
this.frm.add_custom_button(__('Payment Entry'),
function() {
frappe.model.open_mapped_doc({
method: "your_make_method",
frm: me.frm
})
}, __("Make"));
}
For python make implementation, see example:
Hey @snv thank you.
but it’s giving error.
frappe.ui.form.on(“Customer”, ‘refresh’, function(frm){
frm.add_custom_button(__(‘Payment Entry’),
function() {
frappe.model.open_mapped_doc({
‘Payment Entry’: ‘Payment Entry’,
‘Party’: ‘party’,
})
}, __(“Make”));
});
You’ve used open_mapped_doc
incorrectly.
Compare with my implementation:
Also, don’t forget to replace “your_make_method” with your whitelisted make method.
See example:
I have used same method which used in payment_entry.js .
frappe.model.open_mapped_doc({
method: “erpnext.accounts.doctype.payment_entry.payment_entry.make_payment_entry”,
frm: me.frm
})
You’ll have to write your own method.
No, you’ll need to create a python file.
but I have no any access of back-end.
let’s see what i am asking only :
i have created the button of Payment Entry in Customer Dashboard.
when i will create the Payment Entry through Customer the Customer Name(CUST-00001) will fetch into the Party field only.
if there is any solution please suggest me without write any python function.
I am trying to do like this
frappe.ui.form.on(“Customer”, {
refresh: function(frm) {
frm.add_custom_button(__(“Payment Entry”), function() {
frappe.ui.form.on(“Customer”, “lead_name”, function(frm) {
frappe.model.with_doc(“Payment Entry”, frm.doc.party, function() {
var po = frappe.model.get_doc(“Customer”, frm.doc.lead_name);
frm.set_value(“lead”, po.lead_name);
});
});
frappe.new_doc(“Payment Entry”)
}, __(“Make”));
}
});
but tha’s not worked.
Is this issue resolved