validate criteria name

This commit is contained in:
Rushabh Mehta 2011-06-27 16:40:19 +05:30
parent 923a1e5447
commit ca6e0771a9

View file

@ -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()