fix: set correct document label in case doc is of type str

This commit is contained in:
Sagar Vora 2023-08-22 15:18:33 +05:30
parent 8f7a4f6697
commit 29e5ad4fca

View file

@ -985,7 +985,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,