Skip to content

Commit

Permalink
fix: Avoid duplicate contact names (#23731) (#23734)
Browse files Browse the repository at this point in the history
(cherry picked from commit 8129fe7)

Co-authored-by: Ankush Menat <ankush@frappe.io>
  • Loading branch information
mergify[bot] and ankush committed Dec 12, 2023
1 parent 0248c07 commit 5fb8302
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frappe/contacts/doctype/contact/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ class Contact(Document):
def autoname(self):
self.name = self._get_full_name()

if frappe.db.exists("Contact", self.name):
self.name = append_number_if_name_exists("Contact", self.name)

# concat party name if reqd
for link in self.links:
self.name = self.name + "-" + link.link_name.strip()
break

if frappe.db.exists("Contact", self.name):
self.name = append_number_if_name_exists("Contact", self.name)

def validate(self):
self.full_name = self._get_full_name()
self.set_primary_email()
Expand Down

0 comments on commit 5fb8302

Please sign in to comment.