Merge branch 'master' of github.com:webnotes/wnframework into responsive
Conflicts: webnotes/db.py
This commit is contained in:
commit
85bbd693d5
2 changed files with 15 additions and 10 deletions
|
|
@ -330,7 +330,11 @@ class Database:
|
|||
return self.get_values_from_table(fields, filters, doctype, as_dict, debug)
|
||||
except Exception, e:
|
||||
if ignore and e.args[0] in (1146, 1054):
|
||||
# table or column not found, return None
|
||||
return None
|
||||
elif (not ignore) and e.args[0]==1146:
|
||||
# table not found, look in singles
|
||||
pass
|
||||
else:
|
||||
raise e
|
||||
|
||||
|
|
|
|||
|
|
@ -212,18 +212,19 @@ def check_if_doc_is_linked(dt, dn, method="Delete"):
|
|||
"""
|
||||
from webnotes.model.rename_doc import get_link_fields
|
||||
link_fields = get_link_fields(dt)
|
||||
link_fields = [[lf['parent'], lf['fieldname']] for lf in link_fields]
|
||||
link_fields = [[lf['parent'], lf['fieldname'], lf['issingle']] for lf in link_fields]
|
||||
|
||||
for link_dt, link_field in link_fields:
|
||||
item = webnotes.conn.get_value(link_dt, {link_field:dn}, ["name", "parent", "parenttype",
|
||||
"docstatus"], as_dict=True)
|
||||
for link_dt, link_field, issingle in link_fields:
|
||||
if not issingle:
|
||||
item = webnotes.conn.get_value(link_dt, {link_field:dn},
|
||||
["name", "parent", "parenttype", "docstatus"], as_dict=True)
|
||||
|
||||
if item and item.parent != dn and (method=="Delete" or
|
||||
(method=="Cancel" and item.docstatus==1)):
|
||||
webnotes.msgprint(method + " " + _("Error") + ":"+\
|
||||
("%s (%s) " % (dn, dt)) + _("is linked in") + (" %s (%s)") %
|
||||
(item.parent or item.name, item.parent and item.parenttype or link_dt),
|
||||
raise_exception=LinkExistsError)
|
||||
if item and item.parent != dn and (method=="Delete" or
|
||||
(method=="Cancel" and item.docstatus==1)):
|
||||
webnotes.msgprint(method + " " + _("Error") + ":"+\
|
||||
("%s (%s) " % (dn, dt)) + _("is linked in") + (" %s (%s)") %
|
||||
(item.parent or item.name, item.parent and item.parenttype or link_dt),
|
||||
raise_exception=LinkExistsError)
|
||||
|
||||
def set_default(doc, key):
|
||||
if not doc.is_default:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue