Merge pull request #31937 from iamejaaz/35002-shortcut-report-redirect

fix: redirect to report from workspace
This commit is contained in:
Ejaaz Khan 2025-03-27 22:53:00 +05:30 committed by GitHub
commit 2e97ecd68d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 21 additions and 5 deletions

View file

@ -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

View file

@ -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
}
}

View file

@ -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"]

View file

@ -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

View file

@ -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);