diff --git a/erpnext/crm/doctype/lead/lead.json b/erpnext/crm/doctype/lead/lead.json index 2219307caf4..bc007b146f1 100644 --- a/erpnext/crm/doctype/lead/lead.json +++ b/erpnext/crm/doctype/lead/lead.json @@ -1,4 +1,5 @@ { + "actions": [], "allow_events_in_timeline": 1, "allow_import": 1, "autoname": "naming_series:", @@ -30,18 +31,19 @@ "ends_on", "notes_section", "notes", - "contact_info", + "address_info", "address_html", "address_title", "address_line1", "address_line2", "city", "county", + "column_break2", + "contact_html", "state", "country", "pincode", - "column_break2", - "contact_html", + "contact_section", "phone", "mobile_no", "fax", @@ -230,15 +232,6 @@ "fieldtype": "Text Editor", "label": "Notes" }, - { - "collapsible": 1, - "collapsible_depends_on": "eval: doc.__islocal", - "fieldname": "contact_info", - "fieldtype": "Section Break", - "label": "Address & Contact", - "oldfieldtype": "Column Break", - "options": "fa fa-map-marker" - }, { "fieldname": "address_html", "fieldtype": "HTML", @@ -424,12 +417,29 @@ "fieldtype": "Link", "label": "Designation", "options": "Designation" + }, + { + "collapsible": 1, + "collapsible_depends_on": "eval: doc.__islocal", + "fieldname": "address_info", + "fieldtype": "Section Break", + "label": "Address & Contact", + "oldfieldtype": "Column Break", + "options": "fa fa-map-marker" + }, + { + "collapsible": 1, + "collapsible_depends_on": "eval: doc.__islocal", + "fieldname": "contact_section", + "fieldtype": "Section Break", + "label": "Contact" } ], "icon": "fa fa-user", "idx": 5, "image_field": "image", - "modified": "2019-09-20 12:49:02.536647", + "links": [], + "modified": "2019-12-24 16:00:44.239168", "modified_by": "Administrator", "module": "CRM", "name": "Lead", diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py index 6645c4d0019..6cab18dc1c3 100644 --- a/erpnext/crm/doctype/lead/lead.py +++ b/erpnext/crm/doctype/lead/lead.py @@ -161,22 +161,25 @@ class Lead(SellingController): "salutation": self.salutation, "gender": self.gender, "designation": self.designation, - "email_ids": [ - { - "email_id": self.email_id, - "is_primary": 1 - } - ], - "phone_nos": [ - { - "phone": self.phone, - "is_primary": 1 - }, - { - "phone": self.mobile_no, - } - ] }) + + if self.email_id: + contact.append("email_ids", { + "email_id": self.email_id, + "is_primary": 1 + }) + + if self.phone: + contact.append("phone_nos", { + "phone": self.phone, + "is_primary": 1 + }) + + if self.mobile_no: + contact.append("phone_nos", { + "phone": self.mobile_no + }) + contact.insert() return contact