fix: Standard field falsy comparisons in db_query (#32791)
Extends the fix to standard fields. e0f63a928f
This commit is contained in:
parent
30c5376653
commit
ddbaf09125
2 changed files with 3 additions and 1 deletions
|
|
@ -885,7 +885,7 @@ from {tables}
|
|||
df
|
||||
and (db_type := cstr(frappe.db.type_map.get(df.fieldtype, " ")[0]))
|
||||
and db_type in ("varchar", "text", "longtext", "smalltext", "json")
|
||||
):
|
||||
) or f.fieldname in ("owner", "modified_by", "parent", "parentfield", "parenttype"):
|
||||
value = cstr(f.value)
|
||||
fallback = "''"
|
||||
|
||||
|
|
|
|||
|
|
@ -1202,6 +1202,8 @@ class TestDBQuery(IntegrationTestCase):
|
|||
self.assertNotIn("\\'", query)
|
||||
self.assertNotIn("ifnull", query)
|
||||
self.assertFalse(frappe.get_all("DocField", {"name": None}))
|
||||
self.assertFalse(frappe.get_all("DocField", {"parent": None}))
|
||||
self.assertNotIn("0", frappe.get_all("DocField", {"parent": None}, run=0))
|
||||
|
||||
def test_ifnull_fallback_types(self):
|
||||
query = frappe.get_all("DocField", {"fieldname": ("!=", None)}, run=0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue