fix: Revert auto_commit after frappe.sendmail

This commit is contained in:
Gavin D'souza 2021-08-19 18:44:36 +05:30
parent 4cbf2c40e6
commit 6b789ec53a

View file

@ -165,6 +165,7 @@ class Newsletter(WebsiteGenerator):
sender = self.send_from or frappe.utils.get_formatted_email(self.owner)
args = {"message": message, "name": self.name}
is_auto_commit_set = bool(frappe.db.auto_commit_on_many_writes)
frappe.db.auto_commit_on_many_writes = not frappe.flags.in_test
frappe.sendmail(
@ -184,7 +185,7 @@ class Newsletter(WebsiteGenerator):
args=args,
)
frappe.db.auto_commit_on_many_writes = not frappe.flags.in_test
frappe.db.auto_commit_on_many_writes = is_auto_commit_set
def get_message(self) -> str:
if self.content_type == "HTML":