[Fix] Minor fix in data importer (#4690)
This commit is contained in:
parent
5b8c857fc0
commit
fa3c2a219d
1 changed files with 13 additions and 12 deletions
|
|
@ -201,19 +201,20 @@ def upload(rows = None, submit_after_import=None, ignore_encoding_errors=False,
|
|||
def validate_naming(doc):
|
||||
autoname = frappe.get_meta(doctype).autoname
|
||||
|
||||
if ".#" in autoname or "hash" in autoname:
|
||||
autoname = ""
|
||||
elif autoname[0:5] == 'field':
|
||||
autoname = autoname[6:]
|
||||
elif autoname=='naming_series:':
|
||||
autoname = 'naming_series'
|
||||
else:
|
||||
return True
|
||||
if autoname:
|
||||
if ".#" in autoname or "hash" in autoname:
|
||||
autoname = ""
|
||||
elif autoname[0:5] == 'field':
|
||||
autoname = autoname[6:]
|
||||
elif autoname=='naming_series:':
|
||||
autoname = 'naming_series'
|
||||
else:
|
||||
return True
|
||||
|
||||
if (autoname and autoname not in doc) or (autoname and not doc[autoname]):
|
||||
from frappe.model.base_document import get_controller
|
||||
if not hasattr(get_controller(doctype), "autoname"):
|
||||
frappe.throw(_("{0} is a mandatory field".format(autoname)))
|
||||
if (autoname not in doc) or (not doc[autoname]):
|
||||
from frappe.model.base_document import get_controller
|
||||
if not hasattr(get_controller(doctype), "autoname"):
|
||||
frappe.throw(_("{0} is a mandatory field".format(autoname)))
|
||||
return True
|
||||
|
||||
users = frappe.db.sql_list("select name from tabUser")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue