chore: deprecate validate_filters
This commit is contained in:
parent
0a76f1fc36
commit
26b3e6363e
5 changed files with 3 additions and 27 deletions
|
|
@ -644,7 +644,6 @@ class Database:
|
|||
order_by=order_by,
|
||||
distinct=distinct,
|
||||
limit=limit,
|
||||
validate_filters=True,
|
||||
for_update=for_update,
|
||||
skip_locked=skip_locked,
|
||||
wait=True,
|
||||
|
|
@ -666,7 +665,6 @@ class Database:
|
|||
fields=fieldname,
|
||||
distinct=distinct,
|
||||
limit=limit,
|
||||
validate_filters=True,
|
||||
)
|
||||
if isinstance(fieldname, str) and fieldname == "*":
|
||||
as_dict = True
|
||||
|
|
@ -994,7 +992,6 @@ class Database:
|
|||
table=dt,
|
||||
filters=dn,
|
||||
update=True,
|
||||
validate_filters=True,
|
||||
)
|
||||
|
||||
if isinstance(dn, FilterValue):
|
||||
|
|
@ -1301,7 +1298,6 @@ class Database:
|
|||
filters=filters,
|
||||
fields=Count("*"),
|
||||
distinct=distinct,
|
||||
validate_filters=True,
|
||||
).run(debug=debug)[0][0]
|
||||
|
||||
if not filters and cache:
|
||||
|
|
@ -1432,7 +1428,6 @@ class Database:
|
|||
table=doctype,
|
||||
filters=filters,
|
||||
delete=True,
|
||||
validate_filters=True,
|
||||
)
|
||||
if "debug" not in kwargs:
|
||||
kwargs["debug"] = debug
|
||||
|
|
|
|||
|
|
@ -245,6 +245,7 @@ class Engine:
|
|||
This is kept optional to not break existing code that relies on the original query builder behaviour.
|
||||
ignore_user_permissions: Ignore user permissions for the query.
|
||||
Useful for link search queries when the link field has `ignore_user_permissions` set.
|
||||
validate_filters: DEPRECATED. Will be removed in future versions.
|
||||
"""
|
||||
|
||||
qb = frappe.local.qb
|
||||
|
|
@ -253,7 +254,6 @@ class Engine:
|
|||
self.is_mariadb = db_type == "mariadb"
|
||||
self.is_postgres = db_type == "postgres"
|
||||
self.is_sqlite = db_type == "sqlite"
|
||||
self.validate_filters = validate_filters
|
||||
self.user = user or frappe.session.user
|
||||
self.parent_doctype = parent_doctype
|
||||
self.reference_doctype = reference_doctype
|
||||
|
|
@ -772,13 +772,6 @@ class Engine:
|
|||
|
||||
# Handle dot notation (link_field.target_field or child_table_field.target_field)
|
||||
if "." in field:
|
||||
if self.validate_filters:
|
||||
frappe.throw(
|
||||
_("Filtering by link fields is not allowed with validate_filters: {0}").format(field),
|
||||
frappe.ValidationError,
|
||||
title=_("Invalid Filter"),
|
||||
)
|
||||
|
||||
# Disallow tabDoc.field notation in filters.
|
||||
dynamic_field = DynamicTableField.parse(field, self.doctype, allow_tab_notation=False)
|
||||
if dynamic_field:
|
||||
|
|
@ -821,14 +814,6 @@ class Engine:
|
|||
# If a specific doctype is provided and it's different from the main query doctype,
|
||||
# assume it's a child table and add the join using ChildTableField logic.
|
||||
if doctype and doctype != self.doctype:
|
||||
if self.validate_filters:
|
||||
frappe.throw(
|
||||
_(
|
||||
"Filtering by child table doctype explicitly is not allowed with validate_filters: {0}"
|
||||
).format(doctype),
|
||||
frappe.ValidationError,
|
||||
title=_("Invalid Filter"),
|
||||
)
|
||||
# Check if doctype is a valid child table of self.doctype
|
||||
parent_meta = frappe.get_meta(self.doctype)
|
||||
# Find the parent fieldname for this child doctype
|
||||
|
|
|
|||
|
|
@ -206,13 +206,11 @@ def create_number_card(args):
|
|||
@frappe.whitelist()
|
||||
@frappe.validate_and_sanitize_search_inputs
|
||||
def get_cards_for_user(doctype, txt, searchfield, start, page_len, filters):
|
||||
doctype = "Number Card"
|
||||
meta = frappe.get_meta(doctype)
|
||||
searchfields = meta.get_search_fields()
|
||||
search_conditions = []
|
||||
|
||||
if not frappe.db.exists("DocType", doctype):
|
||||
return
|
||||
|
||||
numberCard = DocType("Number Card")
|
||||
|
||||
if txt:
|
||||
|
|
@ -221,7 +219,6 @@ def get_cards_for_user(doctype, txt, searchfield, start, page_len, filters):
|
|||
condition_query = frappe.qb.get_query(
|
||||
doctype,
|
||||
filters=filters,
|
||||
validate_filters=True,
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ def get_group_by_count(doctype: str, current_filters: str, field: str) -> list[d
|
|||
doctype,
|
||||
filters=current_filters,
|
||||
fields=["name"],
|
||||
validate_filters=True,
|
||||
ignore_permissions=False,
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ def get_monthly_results(
|
|||
Function(aggregation, goal_field),
|
||||
],
|
||||
filters=filters,
|
||||
validate_filters=True,
|
||||
ignore_permissions=False,
|
||||
)
|
||||
.groupby("month_year")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue