Skip to content

Commit

Permalink
fix(website): Handle virtual DocTypes webview routing (#24445) (#24743)
Browse files Browse the repository at this point in the history
Co-authored-by: Charles-Henri Decultot <chdecultot@dokos.io>
(cherry picked from commit c9c8414)

Co-authored-by: Corentin Flr <10946971+cogk@users.noreply.github.com>
  • Loading branch information
mergify[bot] and cogk committed Feb 5, 2024
1 parent fd04617 commit bed66ca
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion frappe/website/page_renderers/document_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ def _find_matching_document_webview(route: str) -> tuple[str, str] | None:
filters[condition_field] = 1

try:
docname = frappe.db.get_value(doctype, filters, "name")
docname = None
if meta.is_virtual:
if doclist := frappe.get_all(doctype, filters=filters, fields=["name"], limit=1):
docname = doclist[0].get("name")
else:
docname = frappe.db.get_value(doctype, filters, "name")

if docname:
return (doctype, docname)
except Exception as e:
Expand Down

0 comments on commit bed66ca

Please sign in to comment.