From 62242665129e06f8b27a360a9bf4042d26da0dce Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Mon, 22 Jul 2019 13:04:43 +0530 Subject: [PATCH] fix: replaced frappe.db.get_value with frappe.db.exists --- erpnext/crm/doctype/email_campaign/email_campaign.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/crm/doctype/email_campaign/email_campaign.py b/erpnext/crm/doctype/email_campaign/email_campaign.py index 719c0d078e..1a0bb2c259 100644 --- a/erpnext/crm/doctype/email_campaign/email_campaign.py +++ b/erpnext/crm/doctype/email_campaign/email_campaign.py @@ -38,7 +38,12 @@ class EmailCampaign(Document): frappe.throw(_("Please set an email id for the Lead {0}").format(lead_name)) def validate_email_campaign_already_exists(self): - if frappe.db.get_value("Email Campaign", {"campaign_name": self.campaign_name, "recipient": self.recipient, "status": ("in", ["In Progress", "Scheduled"])}): + email_campaign_exists = frappe.db.exists("Email Campaign", { + "campaign_name": self.campaign_name, + "recipient": self.recipient, + "status": ("in", ["In Progress", "Scheduled"]) + }) + 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)) def update_status(self):