fix: fixing erroneous query conversions

This commit is contained in:
Aradhya-Tripathi 2021-10-13 14:28:13 +05:30
parent 7315076038
commit a621c4178c
2 changed files with 2 additions and 2 deletions

View file

@ -190,7 +190,7 @@ def get_defaults_for(parent="__default"):
# sort descending because first default must get precedence
table = frappe.qb.DocType("DefaultValue")
res = frappe.qb.from_(table).where(table.parent == parent) \
.select(table.defkey, table.defvalue).orderby("creation").run(as_dict=True)
.select(table.defkey, table.defvalue).orderby("creation").run(as_dict=True)
defaults = frappe._dict({})
for d in res:

View file

@ -354,7 +354,7 @@ def get_roles(user=None, with_standard=True):
return [r[0] for r in frappe.qb.from_("Role").select("name").run()] # return all available roles
else:
table = frappe.qb.DocType("Has Role")
result = frappe.qb.form_(table).where(table.parent == user) \
result = frappe.qb.from_(table).where(table.parent == user) \
.where(table.role.notin(["All", "Guest"])).select(table.role).run()
return [r[0] for r in result] + ['All', 'Guest']