From 2fa204d8be98f24136f2cf3eb4c2408f86f35b9f Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Mon, 2 Dec 2019 16:26:10 +0530 Subject: [PATCH] fix: render_template for subject in Email Campaign (#19772) --- erpnext/crm/doctype/email_campaign/email_campaign.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/crm/doctype/email_campaign/email_campaign.py b/erpnext/crm/doctype/email_campaign/email_campaign.py index 3050d05a7c..00a4bd1a32 100644 --- a/erpnext/crm/doctype/email_campaign/email_campaign.py +++ b/erpnext/crm/doctype/email_campaign/email_campaign.py @@ -41,7 +41,8 @@ class EmailCampaign(Document): email_campaign_exists = frappe.db.exists("Email Campaign", { "campaign_name": self.campaign_name, "recipient": self.recipient, - "status": ("in", ["In Progress", "Scheduled"]) + "status": ("in", ["In Progress", "Scheduled"]), + "name": ("!=", self.name) }) if email_campaign_exists: frappe.throw(_("The Campaign '{0}' already exists for the {1} '{2}'").format(self.campaign_name, self.email_campaign_for, self.recipient)) @@ -78,7 +79,7 @@ def send_mail(entry, email_campaign): comm = make( doctype = "Email Campaign", name = email_campaign.name, - subject = email_template.get("subject"), + subject = frappe.render_template(email_template.get("subject"), context), content = frappe.render_template(email_template.get("response"), context), sender = sender, recipients = recipient,