mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-06 13:49:13 +00:00
[fixes] address and contact
This commit is contained in:
@@ -31,12 +31,11 @@ def update_website_context(context):
|
||||
|
||||
def check_customer_or_supplier():
|
||||
if frappe.session.user:
|
||||
contacts = frappe.get_all("Contact", fields=["customer", "supplier", "email_id"],
|
||||
filters={"email_id": frappe.session.user})
|
||||
contact_name = frappe.get_value("Contact", {"email_id": frappe.session.user})
|
||||
if contact_name:
|
||||
contact = frappe.get_doc('Contact', contact_name)
|
||||
for link in contact.links:
|
||||
if link.link_doctype in ('Customer', 'Supplier'):
|
||||
return link.link_doctype, link.link_name
|
||||
|
||||
customer = [d.customer for d in contacts if d.customer] or None
|
||||
supplier = [d.supplier for d in contacts if d.supplier] or None
|
||||
|
||||
if customer: return 'Customer', customer
|
||||
if supplier : return 'Supplier', supplier
|
||||
return 'Customer', None
|
||||
Reference in New Issue
Block a user