Customer Name is not Unique

So you have to apply the server script using validate or on_update method.

existing_customer = frappe.db.get_value("Customer", {"customer_name": doc.customer_name})
if existing_customer:
    frappe.throw("Customer with the same name already exists. Please choose a different name.")

Output:

Thank You!