Merge pull request #52064 from Shankarv19bcr/customer-auto-name-fix

This commit is contained in:
Mihir Kandoi
2026-01-26 15:16:21 +05:30
committed by GitHub

View File

@@ -117,6 +117,7 @@ class Customer(TransactionBase):
set_name_from_naming_options(frappe.get_meta(self.doctype).autoname, self)
def get_customer_name(self):
self.customer_name = self.customer_name.strip()
if frappe.db.get_value("Customer", self.customer_name) and not frappe.flags.in_import:
count = frappe.db.sql(
"""select ifnull(MAX(CAST(SUBSTRING_INDEX(name, ' ', -1) AS UNSIGNED)), 0) from tabCustomer