fix: proper errror translation for finding outgoing email account (#20316)
This commit is contained in:
parent
41685ff014
commit
985a8ca18a
1 changed files with 6 additions and 6 deletions
|
|
@ -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."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue