fix: When Lead is created with mobile_no, mobile_no value gets lost (it is overwritten by phon value) (#26116)
Steps to reproduce
[1]Create a Lead.
[2]Enter Person Name(lead_name): XX
under Contact section, enter Phone(phone): 11 and Mobile No.(mobile_no):22
[3]Save it
[4] F12,
cur_frm.doc.phone : 11 (correct)
cur_frm.doc.mobile_no : 11 (incorrect)
[5]Under Address & Contact section ,check contact_html it shows
ty
Phone: 22 (correct)
Phone: 11 (in correct)
Actual:
mobile_no value is lost. it is overwritten by phone value
Expected:
mobile_no value should be retained
diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py
index d1d0968..ce3de40 100644
--- a/erpnext/crm/doctype/lead/lead.py
+++ b/erpnext/crm/doctype/lead/lead.py
@@ -168,12 +168,13 @@
if self.phone:
contact.append("phone_nos", {
"phone": self.phone,
- "is_primary": 1
+ "is_primary_phone": 1
})
if self.mobile_no:
contact.append("phone_nos", {
- "phone": self.mobile_no
+ "phone": self.mobile_no,
+ "is_primary_mobile_no":1
})
contact.insert(ignore_permissions=True)