From 4f39dfd642eae780f084facc8809285d7c60a470 Mon Sep 17 00:00:00 2001 From: Sakthivel Murugan S <129778327+ssakthivelmurugan@users.noreply.github.com> Date: Thu, 19 Mar 2026 12:04:31 +0530 Subject: [PATCH 1/2] fix: set customer details on customer creation at login (#53509) (cherry picked from commit 256d267a3b94369303927130b8da3f179ef0e79c) # Conflicts: # erpnext/portal/utils.py --- erpnext/portal/utils.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/erpnext/portal/utils.py b/erpnext/portal/utils.py index 903d4a6196c..14c6abe2f4b 100644 --- a/erpnext/portal/utils.py +++ b/erpnext/portal/utils.py @@ -47,8 +47,8 @@ def create_customer_or_supplier(): if party_exists(doctype, user): return - party = frappe.new_doc(doctype) fullname = frappe.utils.get_fullname(user) +<<<<<<< HEAD if not doctype == "Customer": party.update( @@ -62,6 +62,9 @@ def create_customer_or_supplier(): party.flags.ignore_mandatory = True party.insert(ignore_permissions=True) +======= + party = create_party(doctype, fullname) +>>>>>>> 256d267a3b (fix: set customer details on customer creation at login (#53509)) alternate_doctype = "Customer" if doctype == "Supplier" else "Supplier" if party_exists(alternate_doctype, user): @@ -69,6 +72,22 @@ def create_customer_or_supplier(): fullname += "-" + doctype create_party_contact(doctype, fullname, user, party.name) + return party + + +def create_party(doctype, fullname): + party = frappe.new_doc(doctype) + # Can't set parent party as group + + party.update( + { + f"{doctype.lower()}_name": fullname, + f"{doctype.lower()}_type": "Individual", + } + ) + + party.flags.ignore_mandatory = True + party.insert(ignore_permissions=True) return party From e2c8dc538659c2bb9b1ee66f7cd67047ab7f9a11 Mon Sep 17 00:00:00 2001 From: Navin-S-R Date: Thu, 19 Mar 2026 13:06:16 +0530 Subject: [PATCH 2/2] chore: resolve conflict --- erpnext/portal/utils.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/erpnext/portal/utils.py b/erpnext/portal/utils.py index 14c6abe2f4b..cfdf8e18191 100644 --- a/erpnext/portal/utils.py +++ b/erpnext/portal/utils.py @@ -48,23 +48,7 @@ def create_customer_or_supplier(): return fullname = frappe.utils.get_fullname(user) -<<<<<<< HEAD - - if not doctype == "Customer": - party.update( - { - "supplier_name": fullname, - "supplier_group": "All Supplier Groups", - "supplier_type": "Individual", - } - ) - - party.flags.ignore_mandatory = True - party.insert(ignore_permissions=True) - -======= party = create_party(doctype, fullname) ->>>>>>> 256d267a3b (fix: set customer details on customer creation at login (#53509)) alternate_doctype = "Customer" if doctype == "Supplier" else "Supplier" if party_exists(alternate_doctype, user):