[fix] Removed customer, supplier and added link_name from website_list_for_contact file
This commit is contained in:
parent
27e86201fc
commit
11fa7a9311
@ -15,7 +15,8 @@ frappe.ui.form.on("Request for Quotation",{
|
||||
frm.fields_dict["suppliers"].grid.get_field("contact").get_query = function(doc, cdt, cdn){
|
||||
var d =locals[cdt][cdn];
|
||||
return {
|
||||
filters: {'supplier': d.supplier}
|
||||
query: "erpnext.buying.doctype.request_for_quotation.request_for_quotation.get_supplier_contacts",
|
||||
filters: {'supplier': doc.supplier}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -159,6 +159,12 @@ def get_list_context(context=None):
|
||||
list_context["show_sidebar"] = True
|
||||
return list_context
|
||||
|
||||
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
|
||||
or `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')})
|
||||
|
||||
# This method is used to make supplier quotation from material request form.
|
||||
@frappe.whitelist()
|
||||
def make_supplier_quotation(source_name, for_supplier, target_doc=None):
|
||||
@ -289,4 +295,3 @@ def get_item_from_material_requests_based_on_supplier(source_name, target_doc =
|
||||
}, target_doc)
|
||||
|
||||
return target_doc
|
||||
|
@ -100,11 +100,12 @@ def post_process(doctype, data):
|
||||
|
||||
def get_customers_suppliers(doctype, user):
|
||||
meta = frappe.get_meta(doctype)
|
||||
contacts = frappe.get_all("Contact", fields=["customer", "supplier", "email_id"],
|
||||
filters={"email_id": user})
|
||||
contacts = frappe.db.sql(""" select `tabContact`.email_id, `tabDynamic Link`.link_doctype, `tabDynamic Link`.link_name
|
||||
from `tabContact`, `tabDynamic Link` where
|
||||
`tabContact`.name = `tabDynamic Link`.parent and `tabContact`.email_id =%s """, user, as_dict=1)
|
||||
|
||||
customers = [c.customer for c in contacts if c.customer] if meta.get_field("customer") else None
|
||||
suppliers = [c.supplier for c in contacts if c.supplier] if meta.get_field("supplier") else None
|
||||
customers = [c.link_name for c in contacts if c.link_doctype == 'Customer'] if meta.get_field("customer") else None
|
||||
suppliers = [c.link_name for c in contacts if c.link_doctype == 'Supplier'] if meta.get_field("supplier") else None
|
||||
|
||||
return customers, suppliers
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user