Merge pull request #8590 from sahil28297/fix_create_contact

fix(patch): check if contact already exists for user
This commit is contained in:
mergify[bot] 2019-10-12 04:56:29 +00:00 committed by GitHub
commit 849bbe1ca0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,6 +17,8 @@ def execute():
users = frappe.get_all('User', filters={"name": ('not in', 'Administrator, Guest')}, fields=["*"])
for user in users:
if frappe.db.exists("Contact", {"email_id": user.email}) or frappe.db.exists("Contact Email", {"email_id": user.email}):
continue
if user.first_name:
user.first_name = re.sub("[<>]+", '', frappe.safe_decode(user.first_name))
if user.last_name: