fixed voucher import tool

This commit is contained in:
Rushabh Mehta 2012-09-26 16:22:03 +02:00
parent 55fd5f3ed6
commit b0f1d71950
2 changed files with 7 additions and 6 deletions

View File

@ -78,8 +78,11 @@
title = "Check your Balance Sheet and Profit & Loss Statement" title = "Check your Balance Sheet and Profit & Loss Statement"
href="#!Financial Statements">Financial Statements</a> href="#!Financial Statements">Financial Statements</a>
</div> </div>
<div class="section-item">
<a class="section-link"
title = "Import Multiple Vouchers from CSV"
href="#voucher-import-tool">Voucher Import Tool</a>
</div>
</div> </div>
</div> </div>

View File

@ -76,11 +76,10 @@ def import_multiple(common_values, data):
"against_journal_voucher:against_jv"], d, detail.fields) "against_journal_voucher:against_jv"], d, detail.fields)
webnotes.conn.commit() webnotes.conn.commit()
for i in xrange(len(data)): for i in xrange(len(data)):
d = data[i] d = data[i]
jv = webnotes.DictObj() jv = webnotes.DictObj()
webnotes.message_log = []
try: try:
d.posting_date = user_to_str(d.posting_date) d.posting_date = user_to_str(d.posting_date)
d.due_date = user_to_str(d.due_date) d.due_date = user_to_str(d.due_date)
@ -123,7 +122,7 @@ def import_multiple(common_values, data):
webnotes.message_log = [] webnotes.message_log = []
return messages return messages
def get_common_values(rows): def get_common_values(rows):
start = False start = False
@ -155,7 +154,6 @@ def get_data(rows):
if r[0]=="--------Data----------": if r[0]=="--------Data----------":
start_row = i+2 start_row = i+2
columns = [c.replace(" ", "_").lower() for c in rows[i+1]] columns = [c.replace(" ", "_").lower() for c in rows[i+1]]
return data return data
@webnotes.whitelist() @webnotes.whitelist()