fix: removed exessive quotes from query

This commit is contained in:
Aradhya 2022-07-23 17:18:43 +05:30
parent 4e0ec7919e
commit f2ada4630c
2 changed files with 6 additions and 4 deletions

View file

@ -3,7 +3,7 @@ import re
from ast import literal_eval
from functools import cached_property
from types import BuiltinFunctionType
from typing import TYPE_CHECKING, Any, Callable
from typing import Any, Callable
import frappe
from frappe import _
@ -465,7 +465,6 @@ class Engine:
is_list = False
if is_list:
fields = [field.replace("""`""", "") for field in fields]
function_objects += self.function_objects_from_list(fields=fields)
is_str = isinstance(fields, str)
@ -514,6 +513,7 @@ class Engine:
table: str,
fields: list | tuple,
filters: dict[str, str | int] | str | int | list[list | str | int] = None,
run: bool = False,
**kwargs,
):
# Clean up state before each query
@ -539,7 +539,9 @@ class Engine:
else:
query = criterion.select(fields)
query = str(query).replace("``", "`")
if run:
return frappe.db.sql(query, **kwargs)
return query

View file

@ -210,7 +210,7 @@ class DatabaseQuery:
% args
)
if self.locals.get("ignore_permissions"):
if self.locals.get("ignore_permissions") and ("." not in self.qb_fields):
return frappe.qb.engine.get_query(
table=self.doctype,
fields=self.qb_fields,