[minor] frappe.are_emails_muted
This commit is contained in:
parent
ad493f7942
commit
94de362e3c
3 changed files with 6 additions and 3 deletions
|
|
@ -919,6 +919,9 @@ def as_json(obj, indent=1):
|
|||
from frappe.utils.response import json_handler
|
||||
return json.dumps(obj, indent=indent, sort_keys=True, default=json_handler)
|
||||
|
||||
def are_emails_muted():
|
||||
return flags.mute_emails or conf.get("mute_emails") or False
|
||||
|
||||
def get_test_records(doctype):
|
||||
"""Returns list of objects from `test_records.json` in the given doctype's folder."""
|
||||
from frappe.modules import get_doctype_module, get_module_path
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ def flush(from_test=False):
|
|||
# additional check
|
||||
check_bulk_limit([])
|
||||
|
||||
if frappe.flags.mute_emails or frappe.conf.get("mute_emails") or False:
|
||||
if frappe.are_emails_muted():
|
||||
msgprint(_("Emails are muted"))
|
||||
from_test = True
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ def send(email, append_to=None):
|
|||
frappe.flags.sent_mail = email.as_string()
|
||||
return
|
||||
|
||||
if frappe.flags.mute_emails or frappe.conf.get("mute_emails") or False:
|
||||
if frappe.are_emails_muted():
|
||||
frappe.msgprint(_("Emails are muted"))
|
||||
return
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ def get_default_outgoing_email_account(raise_exception_not_set=True):
|
|||
if not email_account and not raise_exception_not_set:
|
||||
return None
|
||||
|
||||
if frappe.flags.mute_emails or frappe.conf.get("mute_emails") or False:
|
||||
if frappe.are_emails_muted():
|
||||
# create a stub
|
||||
email_account = frappe.new_doc("Email Account")
|
||||
email_account.update({
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue