Skip to content

Commit

Permalink
fix: set correct document label in case doc is of type str
Browse files Browse the repository at this point in the history
(cherry picked from commit 29e5ad4)
  • Loading branch information
sagarvora authored and mergify[bot] committed Aug 22, 2023
1 parent 060c4a7 commit 8d3e4fb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frappe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,9 @@ def has_permission(

if throw and not out:
# mimics frappe.throw
document_label = f"{_(doc.doctype)} {doc.name}" if doc else _(doctype)
document_label = (
f"{_(doctype)} {doc if isinstance(doc, str) else doc.name}" if doc else _(doctype)
)
msgprint(
_("No permission for {0}").format(document_label),
raise_exception=ValidationError,
Expand Down

0 comments on commit 8d3e4fb

Please sign in to comment.