Add_fetch from dynamic link field

Dear All
i’m trying to add customer name and supplier name in Journal Entry account i add custo field called
party name

how to add script to fetch customer_name from Customer when selected party type is customer
and supplier_name when selected party type is supplier
i tried
cur_frm.add_fetch(“party”, “customer_name”, “party_name”);
it’s work good with customer but when supplier give error
OperationalError: (1054, “Unknown column ‘customer_name’ in ‘field list’”) which is logic
i’m using codes for customer and supplier that why i need names in jv
any help please

this looks like something that needs to be in the product. Why don’t your create an issue on github?

Meanwhile, you can try writing js:

frappe.ui.form.on('Journal Entry Account', 'party', function(frm, cdt, cdn) {
     var d = frappe.model.get_doc(cdt, cdn);{
        method: "frappe.client.get_value",
	args: {
		doctype: dt.party_type,
		fieldname: dt.party_type=='Customer' ? 'customer_name' : 'supplier_name',
		filters: { name: },
	callback: function(r, rt) {
		if(r.message) {
			frappe.model.set_value(dt.doctype,, 'party_name', r.message);


Created a custom script with this code, why it’s not working?