Skip to content

Commit

Permalink
Merge pull request frappe#26736 from Nihantra-Patel/fix_workspace_rep…
Browse files Browse the repository at this point in the history
…ort_builder_v15

fix: redirect report builder from workspace
  • Loading branch information
rmehta authored Jul 27, 2024
2 parents 968800c + 017b89e commit 801d1a0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
4 changes: 4 additions & 0 deletions frappe/desk/doctype/workspace/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ def validate(self):
except Exception:
frappe.throw(_("Content data shoud be a list"))

for d in self.get("links"):
if d.link_type == "Report" and d.is_query_report != 1:
d.report_ref_doctype = frappe.get_value("Report", d.link_to, "ref_doctype")

def clear_cache(self):
super().clear_cache()
if self.for_user:
Expand Down
10 changes: 9 additions & 1 deletion frappe/desk/doctype/workspace_link/workspace_link.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"link_details_section",
"link_type",
"link_to",
"report_ref_doctype",
"column_break_7",
"dependencies",
"only_for",
Expand Down Expand Up @@ -116,12 +117,19 @@
"ignore_xss_filter": 1,
"label": "Description",
"max_height": "7rem"
},
{
"fieldname": "report_ref_doctype",
"fieldtype": "Link",
"label": "Report Ref DocType",
"options": "DocType",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2024-03-23 16:04:06.025772",
"modified": "2024-06-10 16:04:00.746903",
"modified_by": "Administrator",
"module": "Desk",
"name": "Workspace Link",
Expand Down
1 change: 1 addition & 0 deletions frappe/desk/doctype/workspace_link/workspace_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class WorkspaceLink(Document):
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
report_ref_doctype: DF.Link | None
type: DF.Literal["Link", "Card Break"]
# end: auto-generated types

Expand Down
7 changes: 4 additions & 3 deletions frappe/public/js/frappe/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1299,10 +1299,11 @@ Object.assign(frappe.utils, {
} else if (type === "report") {
if (item.is_query_report) {
route = "query-report/" + item.name;
} else if (!item.doctype) {
route = "report/" + item.name;
} else if (!item.is_query_report && item.report_ref_doctype) {
route =
frappe.router.slug(item.report_ref_doctype) + "/view/report/" + item.name;
} else {
route = frappe.router.slug(item.doctype) + "/view/report/" + item.name;
route = "/report/" + item.name;
}
} else if (type === "page") {
route = item.name;
Expand Down
1 change: 1 addition & 0 deletions frappe/public/js/frappe/widgets/links_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export default class LinksWidget extends Widget {
type: item.link_type,
doctype: item.doctype,
is_query_report: item.is_query_report,
report_ref_doctype: item.report_ref_doctype,
};

if (item.link_type.toLowerCase() == "report" && !item.is_query_report) {
Expand Down

0 comments on commit 801d1a0

Please sign in to comment.