[fix] newsletter list duplicate
diff --git a/erpnext/crm/doctype/newsletter_list/newsletter_list.py b/erpnext/crm/doctype/newsletter_list/newsletter_list.py
index 4f89c9a..ba0eec7 100644
--- a/erpnext/crm/doctype/newsletter_list/newsletter_list.py
+++ b/erpnext/crm/doctype/newsletter_list/newsletter_list.py
@@ -68,7 +68,8 @@
validate_email_add(email, True)
if email:
- try:
+ if not frappe.db.get_value("Newsletter List Subscriber",
+ {"newsletter_list": name, "email": email}):
frappe.get_doc({
"doctype": "Newsletter List Subscriber",
"newsletter_list": name,
@@ -76,10 +77,8 @@
}).insert()
count += 1
- except Exception, e:
- # ignore duplicate
- if e.args[0] != 1062:
- raise
+ else:
+ pass
frappe.msgprint(_("{0} subscribers added").format(count))