fix: ensure correct parenttype when retrieving roles

This commit is contained in:
Sagar Vora 2022-12-05 00:44:09 +05:30
parent 5383f5b8b6
commit 389e675764

View file

@ -427,7 +427,9 @@ def get_roles(user=None, with_standard=True):
table = DocType("Has Role")
roles = (
frappe.qb.from_(table)
.where((table.parent == user) & (table.role.notin(["All", "Guest"])))
.where(
(table.parenttype == "User") & (table.parent == user) & (table.role.notin(["All", "Guest"]))
)
.select(table.role)
.run(pluck=True)
)