diff --git a/frappe/desk/doctype/workspace/workspace.py b/frappe/desk/doctype/workspace/workspace.py index 00393f2a7c..3dd399f036 100644 --- a/frappe/desk/doctype/workspace/workspace.py +++ b/frappe/desk/doctype/workspace/workspace.py @@ -89,6 +89,10 @@ class Workspace(Document): if d.link_type == "Report" and d.is_query_report != 1: d.report_ref_doctype = frappe.get_value("Report", d.link_to, "ref_doctype") + for shortcut in self.get("shortcuts"): + if shortcut.type == "Report": + shortcut.report_ref_doctype = frappe.get_value("Report", shortcut.link_to, "ref_doctype") + if not self.app and self.module: from frappe.modules.utils import get_module_app diff --git a/frappe/desk/doctype/workspace_shortcut/workspace_shortcut.json b/frappe/desk/doctype/workspace_shortcut/workspace_shortcut.json index bc6d6b5221..daffde131f 100644 --- a/frappe/desk/doctype/workspace_shortcut/workspace_shortcut.json +++ b/frappe/desk/doctype/workspace_shortcut/workspace_shortcut.json @@ -14,6 +14,7 @@ "label", "icon", "restrict_to_domain", + "report_ref_doctype", "section_break_5", "stats_filter", "column_break_3", @@ -110,20 +111,29 @@ "fieldtype": "Link", "label": "Kanban Board", "options": "Kanban Board" + }, + { + "fieldname": "report_ref_doctype", + "fieldtype": "Link", + "label": "Report Ref DocType", + "options": "DocType", + "read_only": 1 } ], + "grid_page_length": 50, "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2024-03-23 16:04:06.370271", + "modified": "2025-03-27 20:23:13.192488", "modified_by": "Administrator", "module": "Desk", "name": "Workspace Shortcut", "owner": "Administrator", "permissions": [], "quick_entry": 1, + "row_format": "Dynamic", "sort_field": "creation", "sort_order": "DESC", "states": [], "track_changes": 1 -} \ No newline at end of file +} diff --git a/frappe/desk/doctype/workspace_shortcut/workspace_shortcut.py b/frappe/desk/doctype/workspace_shortcut/workspace_shortcut.py index 22dceb9386..7e44ae9504 100644 --- a/frappe/desk/doctype/workspace_shortcut/workspace_shortcut.py +++ b/frappe/desk/doctype/workspace_shortcut/workspace_shortcut.py @@ -26,6 +26,7 @@ class WorkspaceShortcut(Document): parent: DF.Data parentfield: DF.Data parenttype: DF.Data + report_ref_doctype: DF.Link | None restrict_to_domain: DF.Link | None stats_filter: DF.Code | None type: DF.Literal["DocType", "Report", "Page", "Dashboard", "URL"] diff --git a/frappe/desk/query_report.py b/frappe/desk/query_report.py index 30d808498d..e63f72dba5 100644 --- a/frappe/desk/query_report.py +++ b/frappe/desk/query_report.py @@ -90,7 +90,7 @@ def generate_report_result( result = normalize_result(result, columns) - if report.custom_columns: + if report.get("custom_columns"): # saved columns (with custom columns / with different column order) columns = report.custom_columns @@ -211,7 +211,7 @@ def run( result = None - if sbool(are_default_filters) and report.custom_filters: + if sbool(are_default_filters) and report.get("custom_filters"): filters = report.custom_filters try: @@ -233,7 +233,7 @@ def run( result["add_total_row"] = report.add_total_row and not result.get("skip_total_row", False) - if sbool(are_default_filters) and report.custom_filters: + if sbool(are_default_filters) and report.get("custom_filters"): result["custom_filters"] = report.custom_filters return result diff --git a/frappe/public/js/frappe/widgets/shortcut_widget.js b/frappe/public/js/frappe/widgets/shortcut_widget.js index 7a9d93f860..34ad753a1e 100644 --- a/frappe/public/js/frappe/widgets/shortcut_widget.js +++ b/frappe/public/js/frappe/widgets/shortcut_widget.js @@ -37,6 +37,7 @@ export default class ShortcutWidget extends Widget { doctype: this.ref_doctype, doc_view: this.doc_view, kanban_board: this.kanban_board, + report_ref_doctype: this.report_ref_doctype, }); let filters = frappe.utils.get_filter_from_json(this.stats_filter);