delete_doc
This commit is contained in:
parent
32a255dfa2
commit
fb12a7a589
1 changed files with 6 additions and 1 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue