delete_doc

This commit is contained in:
Rushabh Mehta 2011-07-06 11:24:41 +05:30
parent 32a255dfa2
commit fb12a7a589

View file

@ -26,7 +26,12 @@ def check_if_doc_is_linked(dt, dn):
webnotes.msgprint("Cannot delete %s <b>%s</b> because it is linked in <b>%s</b>" % (dt, dn, item[0][0]), raise_exception=1)
else:
item = sql("select name from `tab%s` where `%s`='%s' and docstatus!=2 limit 1" % (link_dt, link_field, dn))
item = None
try:
item = sql("select name from `tab%s` where `%s`='%s' and docstatus!=2 limit 1" % (link_dt, link_field, dn))
except Exception, e:
if e.args[0]==1146: pass
else: raise e
if item:
webnotes.msgprint("Cannot delete %s <b>%s</b> because it is linked in %s <b>%s</b>" % (dt, dn, link_dt, item[0][0]), raise_exception=1)