diff --git a/frappe/public/js/frappe/views/reports/query_report.js b/frappe/public/js/frappe/views/reports/query_report.js index 6174901237..885e211475 100644 --- a/frappe/public/js/frappe/views/reports/query_report.js +++ b/frappe/public/js/frappe/views/reports/query_report.js @@ -2160,8 +2160,13 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList { `); $(this.$report_footer).append(this.$tree_footer); - this.$tree_footer.find("[data-action=collapse_all_rows]").show(); - this.$tree_footer.find("[data-action=expand_all_rows]").hide(); + if (this.report_settings.initial_depth == 0) { + this.$tree_footer.find("[data-action=expand_all_rows]").show(); + this.$tree_footer.find("[data-action=collapse_all_rows]").hide(); + } else { + this.$tree_footer.find("[data-action=collapse_all_rows]").show(); + this.$tree_footer.find("[data-action=expand_all_rows]").hide(); + } } const message = __(