fix: Set email account in Communication only if exists (#18361)

This commit is contained in:
Nabin Hait 2022-10-11 12:20:59 +05:30 committed by GitHub
parent 768daf0961
commit e821699c82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -165,7 +165,8 @@ class CommunicationEmailMixin:
)
if self.sent_or_received == "Sent" and self._outgoing_email_account:
self.db_set("email_account", self._outgoing_email_account.name)
if frappe.db.exists("Email Account", self._outgoing_email_account.name):
self.db_set("email_account", self._outgoing_email_account.name)
return self._outgoing_email_account