Merge pull request #13295 from resilient-tech/fix-report-link

fix(Workspace): broken links for reports created with Report Builder
This commit is contained in:
mergify[bot] 2021-05-24 17:10:53 +00:00 committed by GitHub
commit 19d905a2e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 9 deletions

View file

@ -1197,10 +1197,12 @@ Object.assign(frappe.utils, {
route = "";
}
}
} else if (type === "report" && item.is_query_report) {
route = "query-report/" + item.name;
} else if (type === "report") {
route = frappe.router.slug(item.name) + "/view/report";
if (item.is_query_report) {
route = "query-report/" + item.name;
} else {
route = frappe.router.slug(item.doctype) + "/view/report/" + item.name;
}
} else if (type === "page") {
route = item.name;
} else if (type === "dashboard") {

View file

@ -61,11 +61,17 @@ export default class LinksWidget extends Widget {
};
this.link_list = this.links.map(item => {
const route = frappe.utils.generate_route({
const opts = {
name: item.link_to,
type: item.link_type,
is_query_report: item.is_query_report
});
};
if (item.link_type == "Report" && !item.is_query_report) {
opts.doctype = item.dependencies;
}
const route = frappe.utils.generate_route(opts);
return $(`<a href="${route}" class="link-item ellipsis ${
item.onboard ? "onboard-spotlight" : ""
@ -103,4 +109,4 @@ export default class LinksWidget extends Widget {
}
});
}
}
}

View file

@ -157,9 +157,7 @@ export default class OnboardingWidget extends Widget {
let route = frappe.utils.generate_route({
name: step.reference_report,
type: "report",
is_query_report: ["Query Report", "Script Report"].includes(
step.report_type
),
is_query_report: step.report_type !== "Report Builder",
doctype: step.report_reference_doctype,
});