fix: set welcome_email to None if template not found
fixes UnboundLocalError: welcome_email referenced before assignment Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
This commit is contained in:
parent
5d92e7cf9f
commit
9df69d214c
1 changed files with 2 additions and 3 deletions
|
|
@ -68,8 +68,7 @@ def add_subscribers(name, email_list):
|
|||
email_list = email_list.replace(",", "\n").split("\n")
|
||||
|
||||
template = frappe.db.get_value('Email Group', name, 'welcome_email_template')
|
||||
if template:
|
||||
welcome_email = frappe.get_doc("Email Template", template)
|
||||
welcome_email = frappe.get_doc("Email Template", template) if template else None
|
||||
|
||||
count = 0
|
||||
for email in email_list:
|
||||
|
|
@ -108,4 +107,4 @@ def send_welcome_email(welcome_email, email, email_group):
|
|||
)
|
||||
|
||||
message = frappe.render_template(welcome_email.response, args)
|
||||
frappe.sendmail(email, subject=welcome_email.subject, message=message)
|
||||
frappe.sendmail(email, subject=welcome_email.subject, message=message)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue