fixes in voucher import tool
diff --git a/accounts/page/voucher_import_tool/voucher_import_tool.py b/accounts/page/voucher_import_tool/voucher_import_tool.py
index 7cff10f..91b6891 100644
--- a/accounts/page/voucher_import_tool/voucher_import_tool.py
+++ b/accounts/page/voucher_import_tool/voucher_import_tool.py
@@ -83,8 +83,14 @@
try:
d.posting_date = parse_date(d.posting_date)
- d.due_date = parse_date(d.due_date)
- d.ref_date = parse_date(d.ref_date)
+ d.due_date = d.due_date and parse_date(d.due_date) or None
+
+ if d.ref_number:
+ if not d.ref_date:
+ raise webnotes.ValidationError,
+ """Ref Date is Mandatory if Ref Number is specified"""
+ d.ref_date = parse_date(d.ref_date)
+
d.company = common_values.company
jv = Document("Journal Voucher")
@@ -120,7 +126,7 @@
webnotes.conn.rollback()
err_msg = webnotes.message_log and webnotes.message_log[0] or unicode(e)
messages.append("<p style='color: red'>[row #%s] %s failed: %s</p>" \
- % ((start_idx + 1) + i, jv.name, err_msg or "No message"))
+ % ((start_idx + 1) + i, jv.name or "", err_msg or "No message"))
webnotes.errprint(webnotes.getTraceback())
webnotes.message_log = []
diff --git a/setup/doctype/setup_control/setup_control.py b/setup/doctype/setup_control/setup_control.py
index b06fdca..b5207c2 100644
--- a/setup/doctype/setup_control/setup_control.py
+++ b/setup/doctype/setup_control/setup_control.py
@@ -193,12 +193,6 @@
for fn in master_dict[d].keys():
rec.fields[fn] = master_dict[d][fn]
- # Note: I have no idea why this was there!
- # # add blank fields
- # for fn in rec.fields:
- # if fn not in master_dict[d].keys()+['name','owner','doctype']:
- # rec.fields[fn] = ''
-
rec_obj = get_obj(doc=rec)
rec_obj.doc.save(1)
if hasattr(rec_obj, 'on_update'):