feat: added "Dashboard Chart" button (#22960)

This commit is contained in:
Vishnu VS 2023-10-30 18:30:03 +05:30 committed by GitHub
parent f51a788a0a
commit e06200400f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,19 @@
// Copyright (c) 2019, Frappe Technologies and contributors
// For license information, please see license.txt
frappe.ui.form.on("Dashboard Chart Source", {});
frappe.ui.form.on("Dashboard Chart Source", {
refresh: function (frm) {
if (!frm.is_new()) {
frm.add_custom_button(
__("Dashboard Chart"),
function () {
let dashboard_chart = frappe.model.get_new_doc("Dashboard Chart");
dashboard_chart.chart_type = "Custom";
dashboard_chart.source = frm.doc.name;
frappe.set_route("Form", "Dashboard Chart", dashboard_chart.name);
},
__("Create")
);
}
},
});