Hooks on open a doctype

Hi All,

i wondering is there any way i could do refresh a field when open a document with some queries to sql…

i want to have list of invoices in some doctype and set the invoice status there… but there is no hooks that can notify when the invoice updated to be paid

thanks
Bobby

did u try onload event in js? using frappe.call in order to load docs?

1 Like

i dunno how its works… so frappe call to do the queries and refresh the page ?

kind of:

frappe.ui.form.on("Meeting Attendee", {
	attendee: function(frm, cdt, cdn) {
		var attendee = frappe.model.get_doc(cdt, cdn);
		if (attendee.attendee) {
			// if attendee, get full name
			frappe.call({
				method: "meeting.meeting.doctype.meeting.meeting.get_full_name",
				args: {
					attendee: attendee.attendee
				},
				callback: function(r) {
					frappe.model.set_value(cdt, cdn, "full_name", r.message);
				}
			});

		} else {
			// if no attendee, clear full name
			frappe.model.set_value(cdt, cdn, "full_name", null);
		}
 	},
});
1 Like