Browse Source

fix: explicitly set doctype in queries (#18403) (#18405)

(cherry picked from commit 2f358dea03)

Co-authored-by: Dany Robert <danyrt@wahni.com>
version-14
mergify[bot] 2 years ago
committed by GitHub
parent
commit
6848ee9c57
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions
  1. +2
    -1
      frappe/contacts/doctype/address/address.py
  2. +2
    -1
      frappe/contacts/doctype/contact/contact.py
  3. +1
    -0
      frappe/core/doctype/user/user.py

+ 2
- 1
frappe/contacts/doctype/address/address.py View File

@@ -228,11 +228,12 @@ def get_company_address(company):
def address_query(doctype, txt, searchfield, start, page_len, filters): def address_query(doctype, txt, searchfield, start, page_len, filters):
from frappe.desk.reportview import get_match_cond from frappe.desk.reportview import get_match_cond


doctype = "Address"
link_doctype = filters.pop("link_doctype") link_doctype = filters.pop("link_doctype")
link_name = filters.pop("link_name") link_name = filters.pop("link_name")


condition = "" condition = ""
meta = frappe.get_meta("Address")
meta = frappe.get_meta(doctype)
for fieldname, value in filters.items(): for fieldname, value in filters.items():
if meta.get_field(fieldname) or fieldname in frappe.db.DEFAULT_COLUMNS: if meta.get_field(fieldname) or fieldname in frappe.db.DEFAULT_COLUMNS:
condition += f" and {fieldname}={frappe.db.escape(value)}" condition += f" and {fieldname}={frappe.db.escape(value)}"


+ 2
- 1
frappe/contacts/doctype/contact/contact.py View File

@@ -210,8 +210,9 @@ def update_contact(doc, method):
def contact_query(doctype, txt, searchfield, start, page_len, filters): def contact_query(doctype, txt, searchfield, start, page_len, filters):
from frappe.desk.reportview import get_match_cond from frappe.desk.reportview import get_match_cond


doctype = "Contact"
if ( if (
not frappe.get_meta("Contact").get_field(searchfield)
not frappe.get_meta(doctype).get_field(searchfield)
and searchfield not in frappe.db.DEFAULT_COLUMNS and searchfield not in frappe.db.DEFAULT_COLUMNS
): ):
return [] return []


+ 1
- 0
frappe/core/doctype/user/user.py View File

@@ -901,6 +901,7 @@ def reset_password(user):
def user_query(doctype, txt, searchfield, start, page_len, filters): def user_query(doctype, txt, searchfield, start, page_len, filters):
from frappe.desk.reportview import get_filters_cond, get_match_cond from frappe.desk.reportview import get_filters_cond, get_match_cond


doctype = "User"
conditions = [] conditions = []


user_type_condition = "and user_type != 'Website User'" user_type_condition = "and user_type != 'Website User'"


Loading…
Cancel
Save