mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 12:19:12 +00:00
voucher import tool - throw message if empty columns are found
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
from webnotes.utils import flt
|
from webnotes.utils import flt, comma_and
|
||||||
|
|
||||||
@webnotes.whitelist()
|
@webnotes.whitelist()
|
||||||
def get_template():
|
def get_template():
|
||||||
@@ -231,6 +231,14 @@ def get_data(rows, company_abbr):
|
|||||||
|
|
||||||
if r[0]=="--------Data----------":
|
if r[0]=="--------Data----------":
|
||||||
start_row = i+2
|
start_row = i+2
|
||||||
|
|
||||||
|
# check for empty columns
|
||||||
|
empty_columns = [i+1 for i, c in enumerate(rows[i+1]) if not c]
|
||||||
|
if empty_columns:
|
||||||
|
raise Exception, """Column No(s). %s %s empty. \
|
||||||
|
Please remove them and try again.""" % (comma_and(empty_columns),
|
||||||
|
len(empty_columns)==1 and "is" or "are")
|
||||||
|
|
||||||
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)]
|
||||||
|
|||||||
Reference in New Issue
Block a user