ERPNext Conference 2019* ERPNext.com Blog

Script of party name

customization

#1

this script not work with supplier party

cur_frm.add_fetch(“party”,“customer_name”,“party_name”);

frappe.ui.form.on('Journal Entry Account', {
	party: function(frm, cdt, cdn) {
		var child = locals[cdt][cdn];
		if(!child.party) return;

		field_map = {"Supplier": "supplier_name", "Customer": "customer_name", "Employee": "employee_name", "Member": "member_name"};

		frm.call({
			method: "frappe.client.get_value",
			args: {
				doctype: child.party_type,
				fieldname: field_map[child.party_type],
				filters: { name: child.party },
			},
			callback: function(r, rt) {
				if(r.message) {
					frappe.model.set_value(cdt, cdn, "party_name", r.message[field_map[child.party_type]]);
				}
			}
		});

	}
})

this message is Appear

Wrong fieldname customer_name in add_fetch configuration of custom script


#2

Continues here Party name script


#3