fix: Wait for user creation before creating contact (#20022)

closes https://github.com/frappe/frappe/issues/19995
This commit is contained in:
Ankush Menat 2023-02-14 12:24:31 +05:30 committed by GitHub
parent e9c57ee76e
commit 1cc51e6bb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -122,11 +122,20 @@ class User(Document):
now = frappe.flags.in_test or frappe.flags.in_install
self.send_password_notification(self.__new_password)
frappe.enqueue(
"frappe.core.doctype.user.user.create_contact", user=self, ignore_mandatory=True, now=now
"frappe.core.doctype.user.user.create_contact",
user=self,
ignore_mandatory=True,
now=now,
enqueue_after_commit=True,
)
if self.name not in STANDARD_USERS and not self.user_image:
frappe.enqueue("frappe.core.doctype.user.user.update_gravatar", name=self.name, now=now)
frappe.enqueue(
"frappe.core.doctype.user.user.update_gravatar",
name=self.name,
now=now,
enqueue_after_commit=True,
)
# Set user selected timezone
if self.time_zone: