Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add first and last name fields to quick entry customer creation #46281

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions erpnext/public/js/utils/contact_address_quick_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ frappe.ui.form.ContactAddressQuickEntryForm = class ContactAddressQuickEntryForm
const map_field_names = {
email_address: "email_id",
mobile_number: "mobile_no",
map_to_first_name : "first_name",
map_to_last_name: "last_name"
};

Object.entries(map_field_names).forEach(([fieldname, new_fieldname]) => {
Expand All @@ -39,14 +41,27 @@ frappe.ui.form.ContactAddressQuickEntryForm = class ContactAddressQuickEntryForm
collapsible: 1,
},
{
label: __("Email Id"),
fieldname: "email_address",
label: __("First Name"),
fieldname: "map_to_first_name",
fieldtype: "Data",
options: "Email",
depends_on: "eval:doc.customer_type=='Company'"
},
{
label: __("Last Name"),
fieldname: "map_to_last_name",
fieldtype: "Data",
depends_on: "eval:doc.customer_type=='Company'"
},

{
fieldtype: "Column Break",
},
{
label: __("Email Id"),
fieldname: "email_address",
fieldtype: "Data",
options: "Email",
},
{
label: __("Mobile Number"),
fieldname: "mobile_number",
Expand Down
5 changes: 3 additions & 2 deletions erpnext/selling/doctype/customer/customer.json
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@
"link_fieldname": "party"
}
],
"modified": "2024-06-17 03:24:59.612974",
"modified": "2025-03-04 15:24:57.292163",
"modified_by": "Administrator",
"module": "Selling",
"name": "Customer",
Expand Down Expand Up @@ -672,11 +672,12 @@
}
],
"quick_entry": 1,
"row_format": "Dynamic",
"search_fields": "customer_group,territory, mobile_no,primary_address",
"show_name_in_global_search": 1,
"sort_field": "creation",
"sort_order": "DESC",
"states": [],
"title_field": "customer_name",
"track_changes": 1
}
}
7 changes: 6 additions & 1 deletion erpnext/selling/doctype/customer/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def update_customer_groups(self):

def create_primary_contact(self):
if not self.customer_primary_contact and not self.lead_name:
if self.mobile_no or self.email_id:
if self.mobile_no or self.email_id or self.first_name or self.last_name:
contact = make_contact(self)
self.db_set("customer_primary_contact", contact.name)
self.db_set("mobile_no", self.mobile_no)
Expand Down Expand Up @@ -723,6 +723,11 @@ def make_contact(args, is_primary_contact=1):
contact.add_email(args.get("email_id"), is_primary=True)
if args.get("mobile_no"):
contact.add_phone(args.get("mobile_no"), is_primary_mobile_no=True)
if args.get("first_name"):
contact.first_name = args.get("first_name")
if args.get("last_name"):
contact.last_name = args.get("last_name")


if flags := args.get("flags"):
contact.insert(ignore_permissions=flags.get("ignore_permissions"))
Expand Down
Loading