fix: button "Add Chart to Dashboard" visible before saving (#23256)
* fix: dashboard chart - add chart to dashboard btn fix * style: format [skip ci] --------- Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
parent
e2a7e54af8
commit
a5b102dcd2
1 changed files with 14 additions and 12 deletions
|
|
@ -30,19 +30,21 @@ frappe.ui.form.on("Dashboard Chart", {
|
|||
frm.disable_form();
|
||||
}
|
||||
|
||||
frm.add_custom_button("Add Chart to Dashboard", () => {
|
||||
const dialog = frappe.dashboard_utils.get_add_to_dashboard_dialog(
|
||||
frm.doc.name,
|
||||
"Dashboard Chart",
|
||||
"frappe.desk.doctype.dashboard_chart.dashboard_chart.add_chart_to_dashboard"
|
||||
);
|
||||
if (!frm.is_new()) {
|
||||
frm.add_custom_button("Add Chart to Dashboard", () => {
|
||||
const dialog = frappe.dashboard_utils.get_add_to_dashboard_dialog(
|
||||
frm.doc.name,
|
||||
"Dashboard Chart",
|
||||
"frappe.desk.doctype.dashboard_chart.dashboard_chart.add_chart_to_dashboard"
|
||||
);
|
||||
|
||||
if (!frm.doc.chart_name) {
|
||||
frappe.msgprint(__("Please create chart first"));
|
||||
} else {
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
if (!frm.doc.chart_name) {
|
||||
frappe.msgprint(__("Please create chart first"));
|
||||
} else {
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
frm.set_df_property("filters_section", "hidden", 1);
|
||||
frm.set_df_property("dynamic_filters_section", "hidden", 1);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue