fix in delete doc
This commit is contained in:
parent
61ea1a63f4
commit
dfbc02ed2a
1 changed files with 6 additions and 1 deletions
|
|
@ -66,7 +66,12 @@ def check_if_doc_is_linked(dt, dn):
|
|||
else:
|
||||
item = None
|
||||
try:
|
||||
item = sql("select name, parent, parenttype from `tab%s` where `%s`='%s' and docstatus!=2 and `%s`!=parent limit 1" % (link_dt, link_field, dn, link_field))
|
||||
# (ifnull(parent, '')='' or `%s`!=`parent`)
|
||||
# this condition ensures that it allows deletion when child table field references parent
|
||||
|
||||
item = sql("select name, parent, parenttype from `tab%s` where `%s`='%s' and docstatus!=2 and (ifnull(parent, '')='' or `%s`!=`parent`) \
|
||||
limit 1" % (link_dt, link_field, dn, link_field), debug=1)
|
||||
|
||||
except Exception, e:
|
||||
if e.args[0]==1146: pass
|
||||
else: raise e
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue