fix: contact search in request for quotation (backport #31828) (#31841)

* fix: contact search in request for quotation (#31828)

(cherry picked from commit e5e88bb9f1)

# Conflicts:
#	erpnext/buying/doctype/request_for_quotation/request_for_quotation.py

* chore: conflicts

Co-authored-by: Sagar Sharma <sagarsharma.s312@gmail.com>
This commit is contained in:
mergify[bot]
2022-08-17 11:23:24 +05:30
committed by GitHub
parent ba8dc8925f
commit 2a615af00a
2 changed files with 6 additions and 15 deletions

View File

@@ -15,9 +15,12 @@ frappe.ui.form.on("Request for Quotation",{
frm.fields_dict["suppliers"].grid.get_field("contact").get_query = function(doc, cdt, cdn) {
let d = locals[cdt][cdn];
return {
query: "erpnext.buying.doctype.request_for_quotation.request_for_quotation.get_supplier_contacts",
filters: {'supplier': d.supplier}
}
query: "frappe.contacts.doctype.contact.contact.contact_query",
filters: {
link_doctype: "Supplier",
link_name: d.supplier || ""
}
};
}
},

View File

@@ -287,18 +287,6 @@ def get_list_context(context=None):
return list_context
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def get_supplier_contacts(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql(
"""select `tabContact`.name from `tabContact`, `tabDynamic Link`
where `tabDynamic Link`.link_doctype = 'Supplier' and (`tabDynamic Link`.link_name=%(name)s
and `tabDynamic Link`.link_name like %(txt)s) and `tabContact`.name = `tabDynamic Link`.parent
limit %(start)s, %(page_len)s""",
{"start": start, "page_len": page_len, "txt": "%%%s%%" % txt, "name": filters.get("supplier")},
)
@frappe.whitelist()
def make_supplier_quotation_from_rfq(source_name, target_doc=None, for_supplier=None):
def postprocess(source, target_doc):