diff --git a/core/page/data_import_tool/data_import_tool.py b/core/page/data_import_tool/data_import_tool.py index cb9c99d78e..c8fce2f9e1 100644 --- a/core/page/data_import_tool/data_import_tool.py +++ b/core/page/data_import_tool/data_import_tool.py @@ -389,13 +389,13 @@ def upload(rows = None, submit_after_import=None, ignore_encoding_errors=False, if len(doclist) > 1: if overwrite: bean = webnotes.bean(doctype, doclist[0]["name"]) - bean.ignore_check_links = ignore_links + bean.ignore_links = ignore_links bean.doclist.update(doclist) bean.save() ret.append('Updated row (#%d) %s' % (row_idx + 1, getlink(bean.doc.doctype, bean.doc.name))) else: bean = webnotes.bean(doclist) - bean.ignore_check_links = ignore_links + bean.ignore_links = ignore_links bean.insert() ret.append('Inserted row (#%d) %s' % (row_idx + 1, getlink(bean.doc.doctype, bean.doc.name))) if submit_after_import: @@ -416,7 +416,7 @@ def upload(rows = None, submit_after_import=None, ignore_encoding_errors=False, doc.parent), unicode(doc.idx))) parent_list.append(doc.parent) else: - ret.append(import_doc(doclist[0], doctype, overwrite, row_idx, submit_after_import)) + ret.append(import_doc(doclist[0], doctype, overwrite, row_idx, submit_after_import, ignore_links)) except Exception, e: error = True diff --git a/webnotes/model/bean.py b/webnotes/model/bean.py index f422daac68..7c4f395c62 100644 --- a/webnotes/model/bean.py +++ b/webnotes/model/bean.py @@ -26,7 +26,7 @@ class Bean: self.obj = None self.ignore_permissions = False self.ignore_children_type = [] - self.ignore_check_links = False + self.ignore_links = False self.ignore_validate = False self.ignore_fields = False self.ignore_mandatory = False @@ -157,7 +157,7 @@ class Bean: labels[self.to_docstatus], raise_exception=DocstatusTransitionError) def check_links(self): - if self.ignore_check_links: + if self.ignore_links: return ref, err_list = {}, [] for d in self.doclist: diff --git a/webnotes/modules/import_file.py b/webnotes/modules/import_file.py index 347395e837..e4d9b975fc 100644 --- a/webnotes/modules/import_file.py +++ b/webnotes/modules/import_file.py @@ -85,7 +85,7 @@ def import_doclist(doclist): # reload_new new_bean = webnotes.bean(doclist1) new_bean.ignore_children_type = ignore - new_bean.ignore_check_links = True + new_bean.ignore_links = True new_bean.ignore_validate = True new_bean.ignore_permissions = True new_bean.ignore_mandatory = True diff --git a/webnotes/utils/datautils.py b/webnotes/utils/datautils.py index 231a0ccc34..f08c03d646 100644 --- a/webnotes/utils/datautils.py +++ b/webnotes/utils/datautils.py @@ -126,11 +126,12 @@ def check_record(d, parenttype=None, doctype_dl=None): elif val and docfield.fieldtype in ["Currency", "Float"]: d[key] = flt(val) -def import_doc(d, doctype, overwrite, row_idx, submit=False): +def import_doc(d, doctype, overwrite, row_idx, submit=False, ignore_links=False): """import main (non child) document""" if d.get("name") and webnotes.conn.exists(doctype, d['name']): if overwrite: bean = webnotes.bean(doctype, d['name']) + bean.ignore_links = ignore_links bean.doc.fields.update(d) if d.get("docstatus") == 1: bean.update_after_submit() @@ -142,6 +143,7 @@ def import_doc(d, doctype, overwrite, row_idx, submit=False): getlink(doctype, d['name'])) else: bean = webnotes.bean([d]) + bean.ignore_links = ignore_links bean.insert() if submit: diff --git a/wnf.py b/wnf.py index 2af8270e9d..770e12cd7d 100755 --- a/wnf.py +++ b/wnf.py @@ -550,7 +550,7 @@ def run(): webnotes.conn.commit() if f.endswith(".csv"): from core.page.data_import_tool.data_import_tool import import_file_by_path - import_file_by_path(f) + import_file_by_path(f, ignore_links=True) webnotes.conn.commit() elif options.reset_perms: