fixes in voucher import tool

This commit is contained in:
Anand Doshi 2012-10-05 15:58:47 +05:30
parent 10667521da
commit 372697d9c5
2 changed files with 9 additions and 9 deletions

View File

@ -83,8 +83,14 @@ def import_multiple(common_values, data, start_idx):
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 @@ def import_multiple(common_values, data, start_idx):
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 = []

View File

@ -193,12 +193,6 @@ class DocType:
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'):