From 4844fbb92c6ce35edca580def989320715a01007 Mon Sep 17 00:00:00 2001 From: ci2014 Date: Fri, 14 Sep 2018 00:53:11 +0200 Subject: [PATCH] Fix recipients by document field When having multiple documents in the loop, email_by_document_field would be overridden by the mail address(es). In my case every trigger would only send one email, because for the doc following on the first one, the email_by_document_field would contain mail addresses instead of the field name. Prefixing with tmp_ solves the problem, because we only need the key in that lines. --- frappe/email/doctype/email_alert/email_alert.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frappe/email/doctype/email_alert/email_alert.py b/frappe/email/doctype/email_alert/email_alert.py index 1da959956f..1bf867bbce 100755 --- a/frappe/email/doctype/email_alert/email_alert.py +++ b/frappe/email/doctype/email_alert/email_alert.py @@ -135,8 +135,8 @@ def get_context(context): continue if recipient.email_by_document_field: if validate_email_add(doc.get(recipient.email_by_document_field)): - recipient.email_by_document_field = doc.get(recipient.email_by_document_field).replace(",", "\n") - recipients = recipients + recipient.email_by_document_field.split("\n") + recipient.tmp_email_by_document_field = doc.get(recipient.email_by_document_field).replace(",", "\n") + recipients = recipients + recipient.tmp_email_by_document_field.split("\n") # else: # print "invalid email"