diff --git a/crm/api/contact.py b/crm/api/contact.py index 6a812d5f..6d864d7a 100644 --- a/crm/api/contact.py +++ b/crm/api/contact.py @@ -14,24 +14,16 @@ def update_deals_email_mobile_no(doc): ) for linked_deal in linked_deals: - deal = frappe.get_cached_doc("CRM Deal", linked_deal.parent) + deal = frappe.db.get_values("CRM Deal", linked_deal.parent, ["email", "mobile_no"], as_dict=True)[0] if deal.email != doc.email_id or deal.mobile_no != doc.mobile_no: - deal.email = doc.email_id - deal.mobile_no = doc.mobile_no - deal.save(ignore_permissions=True) - - -@frappe.whitelist() -def get_contact(name): - contact = frappe.get_doc("Contact", name) - contact.check_permission("read") - - contact = contact.as_dict() - - if not len(contact): - frappe.throw(_("Contact not found"), frappe.DoesNotExistError) - - return contact + frappe.db.set_value( + "CRM Deal", + linked_deal.parent, + { + "email": doc.email_id, + "mobile_no": doc.mobile_no, + }, + ) @frappe.whitelist() diff --git a/crm/fcrm/doctype/crm_deal/api.py b/crm/fcrm/doctype/crm_deal/api.py index dd5d76df..499d48ac 100644 --- a/crm/fcrm/doctype/crm_deal/api.py +++ b/crm/fcrm/doctype/crm_deal/api.py @@ -1,6 +1,6 @@ import frappe -from crm.api.doc import get_assigned_users, get_fields_meta +from crm.api.doc import get_fields_meta from crm.fcrm.doctype.crm_form_script.crm_form_script import get_form_script @@ -32,24 +32,12 @@ def get_deal_contacts(name): is_primary = contact.is_primary contact = frappe.get_doc("Contact", contact.contact).as_dict() - def get_primary_email(contact): - for email in contact.email_ids: - if email.is_primary: - return email.email_id - return contact.email_ids[0].email_id if contact.email_ids else "" - - def get_primary_mobile_no(contact): - for phone in contact.phone_nos: - if phone.is_primary: - return phone.phone - return contact.phone_nos[0].phone if contact.phone_nos else "" - _contact = { "name": contact.name, "image": contact.image, "full_name": contact.full_name, - "email": get_primary_email(contact), - "mobile_no": get_primary_mobile_no(contact), + "email": contact.email_id, + "mobile_no": contact.mobile_no, "is_primary": is_primary, } deal_contacts.append(_contact) diff --git a/crm/fcrm/doctype/crm_deal/crm_deal.json b/crm/fcrm/doctype/crm_deal/crm_deal.json index 6b7ce0fe..1f9f604f 100644 --- a/crm/fcrm/doctype/crm_deal/crm_deal.json +++ b/crm/fcrm/doctype/crm_deal/crm_deal.json @@ -130,14 +130,16 @@ { "fieldname": "email", "fieldtype": "Data", - "label": "Email", - "options": "Email" + "label": "Primary Email", + "options": "Email", + "read_only": 1 }, { "fieldname": "mobile_no", "fieldtype": "Data", - "label": "Mobile No", - "options": "Phone" + "label": "Primary Mobile No", + "options": "Phone", + "read_only": 1 }, { "default": "Qualification", @@ -250,8 +252,9 @@ { "fieldname": "phone", "fieldtype": "Data", - "label": "Phone", - "options": "Phone" + "label": "Primary Phone", + "options": "Phone", + "read_only": 1 }, { "fieldname": "log_tab", @@ -411,7 +414,7 @@ "grid_page_length": 50, "index_web_pages_for_search": 1, "links": [], - "modified": "2025-07-02 11:07:50.192089", + "modified": "2025-07-05 12:25:05.927806", "modified_by": "Administrator", "module": "FCRM", "name": "CRM Deal", diff --git a/crm/fcrm/doctype/crm_lead/api.py b/crm/fcrm/doctype/crm_lead/api.py index e826e888..cfb89540 100644 --- a/crm/fcrm/doctype/crm_lead/api.py +++ b/crm/fcrm/doctype/crm_lead/api.py @@ -1,6 +1,6 @@ import frappe -from crm.api.doc import get_assigned_users, get_fields_meta +from crm.api.doc import get_fields_meta from crm.fcrm.doctype.crm_form_script.crm_form_script import get_form_script diff --git a/frontend/src/components/SidePanelLayout.vue b/frontend/src/components/SidePanelLayout.vue index 1bfe6b3a..eac3eec8 100644 --- a/frontend/src/components/SidePanelLayout.vue +++ b/frontend/src/components/SidePanelLayout.vue @@ -125,7 +125,7 @@ />
{{ __('No {0} Available', [field.label]) diff --git a/frontend/src/pages/Contact.vue b/frontend/src/pages/Contact.vue index 396db22f..ccdd8e52 100644 --- a/frontend/src/pages/Contact.vue +++ b/frontend/src/pages/Contact.vue @@ -1,5 +1,5 @@