mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 00:44:45 +00:00
fix in voucher import tool
This commit is contained in:
@@ -206,7 +206,7 @@ def get_data(rows, company_abbr):
|
|||||||
if accounts:
|
if accounts:
|
||||||
total_debit = total_credit = 0
|
total_debit = total_credit = 0
|
||||||
for acc_idx in xrange(len(accounts)):
|
for acc_idx in xrange(len(accounts)):
|
||||||
col_idx = len(columns) - 1 + acc_idx
|
col_idx = len(columns) + acc_idx
|
||||||
if flt(r[col_idx]) != 0:
|
if flt(r[col_idx]) != 0:
|
||||||
if not acc_dict.get(accounts[acc_idx]):
|
if not acc_dict.get(accounts[acc_idx]):
|
||||||
acc_dict[accounts[acc_idx]] = 0
|
acc_dict[accounts[acc_idx]] = 0
|
||||||
@@ -215,7 +215,7 @@ def get_data(rows, company_abbr):
|
|||||||
total_debit += flt(r[col_idx])
|
total_debit += flt(r[col_idx])
|
||||||
else:
|
else:
|
||||||
total_credit += abs(flt(r[col_idx]))
|
total_credit += abs(flt(r[col_idx]))
|
||||||
|
|
||||||
d['total_debit'] = total_debit
|
d['total_debit'] = total_debit
|
||||||
d['total_credit'] = total_credit
|
d['total_credit'] = total_credit
|
||||||
|
|
||||||
@@ -227,5 +227,9 @@ def get_data(rows, company_abbr):
|
|||||||
columns = [c.replace(" ", "_").lower() for c in rows[i+1]
|
columns = [c.replace(" ", "_").lower() for c in rows[i+1]
|
||||||
if not c.endswith(" - " + company_abbr)]
|
if not c.endswith(" - " + company_abbr)]
|
||||||
accounts = [c for c in rows[i+1] if c.endswith(" - " + company_abbr)]
|
accounts = [c for c in rows[i+1] if c.endswith(" - " + company_abbr)]
|
||||||
|
|
||||||
|
if accounts and (len(columns) != rows[i+1].index(accounts[0])):
|
||||||
|
raise Exception, """A non-account column cannot be after an account \
|
||||||
|
column. Please rectify it in the file and try again."""
|
||||||
|
|
||||||
return data, start_row_idx
|
return data, start_row_idx
|
||||||
Reference in New Issue
Block a user