diff --git a/cgi-bin/core/doctype/search_criteria/search_criteria.py b/cgi-bin/core/doctype/search_criteria/search_criteria.py index b9b5d3c84c..00e5eb4330 100644 --- a/cgi-bin/core/doctype/search_criteria/search_criteria.py +++ b/cgi-bin/core/doctype/search_criteria/search_criteria.py @@ -27,7 +27,8 @@ class DocType: webnotes.conn.set(self.doc,'module',doctype_module and doctype_module[0][0] or 'NULL') def validate(self): - sql("select name from `tabSearch Criteria` where criteria_name=%s and name!=%s", (self.doc.criteria_name, self.doc.name)) + if sql("select name from `tabSearch Criteria` where criteria_name=%s and name!=%s", (self.doc.criteria_name, self.doc.name)): + webnots.msgprint("Criteria Name '%s' already used, please use another name" % self.doc.criteria_name, raise_exception = 1) def on_update(self): self.set_module()