From 985a8ca18a8be1e18c745b6b3af3bbcdd891eb0a Mon Sep 17 00:00:00 2001 From: Ritwik Puri Date: Mon, 13 Mar 2023 21:05:48 +0530 Subject: [PATCH] fix: proper errror translation for finding outgoing email account (#20316) --- frappe/email/doctype/email_account/email_account.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frappe/email/doctype/email_account/email_account.py b/frappe/email/doctype/email_account/email_account.py index aa0935e028..2e5dbe2e24 100755 --- a/frappe/email/doctype/email_account/email_account.py +++ b/frappe/email/doctype/email_account/email_account.py @@ -19,7 +19,6 @@ from frappe.email.utils import get_port from frappe.model.document import Document from frappe.utils import cint, comma_or, cstr, parse_addr, validate_email_address from frappe.utils.background_jobs import enqueue, get_jobs -from frappe.utils.error import raise_error_on_no_output from frappe.utils.jinja import render_template from frappe.utils.user import get_system_managers @@ -301,11 +300,6 @@ class EmailAccount(Document): return cls.from_record({"sender": "notifications@example.com"}) @classmethod - @raise_error_on_no_output( - keep_quiet=lambda: not cint(frappe.get_system_settings("setup_complete")), - error_message=_("Please setup default Email Account from Setup > Email > Email Account"), - error_type=frappe.OutgoingEmailError, - ) # noqa @cache_email_account("outgoing_email_account") def find_outgoing(cls, match_by_email=None, match_by_doctype=None, _raise_error=False): """Find the outgoing Email account to use. @@ -329,6 +323,12 @@ class EmailAccount(Document): if doc: return {"default": doc} + if _raise_error: + frappe.throw( + _("Please setup default Email Account from Setup > Email > Email Account"), + frappe.OutgoingEmailError, + ) + @classmethod def find_default_outgoing(cls): """Find default outgoing account."""