refactor: removed unnecesary pseudocolumns

This commit is contained in:
Aradhya 2022-07-24 14:22:57 +05:30
parent 3802d83900
commit 3d6247efbd
3 changed files with 8 additions and 9 deletions

View file

@ -38,7 +38,7 @@ def validate(user, doctype):
def get_columns_and_fields(doctype):
columns = [f"Name:Link/{doctype}:200"]
fields = ["`name`"]
fields = ["name"]
for df in frappe.get_meta(doctype).fields:
if df.in_list_view and df.fieldtype in data_fieldtypes:
fields.append(f"`{df.fieldname}`")

View file

@ -104,12 +104,12 @@ def get_users(doctype, name):
return frappe.db.get_all(
"DocShare",
fields=[
"`name`",
"`user`",
"`read`",
"`write`",
"`submit`",
"`share`",
"name", # Don't understant the need for pseudocolumns here, don't know why get_all supports it?
"user",
"read",
"write",
"submit",
"share",
"everyone",
"owner",
"creation",

View file

@ -4,7 +4,6 @@ import frappe
from frappe.query_builder import Field
from frappe.query_builder.functions import Abs, Count, Max, Timestamp
from frappe.tests.test_query_builder import db_type_is, run_only_if
from frappe.query_builder.utils import PseudoColumn
class TestQuery(unittest.TestCase):
@ -50,7 +49,7 @@ class TestQuery(unittest.TestCase):
frappe.qb.from_("User")
.select(Field("name"), Field("email"))
.where(Field("name") == "Administrator")
.run()
.run(),
)
def test_functions_fields(self):