Customer summary form view

Hello everybody!

Can someone direct me in the right way?
In Customer form view there is a summary for a Customer (“Total Billing This Year” and so on). How is it made? I found a function in customer.py:


def get_dashboard_info(customer)…


and a function which calls it in customer.js:


frappe.ui.form.on(“Customer”, “refresh”, function(frm) {
cur_frm.cscript.setup_dashboard(frm.doc)

}


But I can’t find and can’t understand how it is shown on screen. Where is template for it or something that renders it in form view?

Thanks in advance.

I’ve found how to. It it javascript function that renders “dashboard”. It sets headline and adds doctype_badge:


cur_frm.cscript.setup_dashboard = function(doc) {
	cur_frm.dashboard.reset(doc);
	if(doc.__islocal)
		return;
	if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager"))
		cur_frm.dashboard.set_headline('<span class="text-muted">'+ __('Loading...')+ '</span>')

	cur_frm.dashboard.add_doctype_badge("Opportunity", "customer");
	cur_frm.dashboard.add_doctype_badge("Quotation", "customer");
	cur_frm.dashboard.add_doctype_badge("Sales Order", "customer");
	cur_frm.dashboard.add_doctype_badge("Delivery Note", "customer");
	cur_frm.dashboard.add_doctype_badge("Sales Invoice", "customer");
	cur_frm.dashboard.add_doctype_badge("Project", "customer");

	return frappe.call({
		type: "GET",
		method: "erpnext.selling.doctype.customer.customer.get_dashboard_info",
		args: {
			customer: cur_frm.doc.name
		},
		callback: function(r) {
			if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager")) {
				if(r.message["company_currency"].length == 1) {
					cur_frm.dashboard.set_headline(
						__("Total Billing This Year: ") + "<b>"
						+ format_currency(r.message.billing_this_year, r.message["company_currency"][0])
						+ '</b> / <span class="text-muted">' + __("Unpaid") + ": <b>"
						+ format_currency(r.message.total_unpaid, r.message["company_currency"][0])
						+ '</b></span>');
				} else {
					cur_frm.dashboard.set_headline("");
				}
			}
			cur_frm.dashboard.set_badge_count(r.message);
		}
	});
}

solved