fix(query): don't allow using Document as a filter value (#34823)
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
parent
5fecde5a6a
commit
bd044e520c
1 changed files with 4 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ from frappe.database.utils import (
|
|||
)
|
||||
from frappe.model import get_permitted_fields
|
||||
from frappe.model.base_document import DOCTYPES_FOR_DOCTYPE
|
||||
from frappe.model.document import Document
|
||||
from frappe.query_builder import Criterion, Field, Order, functions
|
||||
from frappe.query_builder.custom import Month, MonthName, Quarter
|
||||
from frappe.query_builder.utils import PseudoColumnMapper
|
||||
|
|
@ -454,6 +455,9 @@ class Engine:
|
|||
else:
|
||||
# Regular value processing for literal comparisons like: table.field = 'value'
|
||||
_value = convert_to_value(value)
|
||||
|
||||
if isinstance(value, Document):
|
||||
frappe.throw(_("Document cannot be used as a filter value"))
|
||||
_operator = operator
|
||||
|
||||
# For Date fields with datetime values, convert to date to match db_query behavior
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue