Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions csf_za/overrides/accounts/bank_statement_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,15 @@ def parse_csv_file_capitec(self, file_doc):
file_content = file_doc.get_content()
data = read_csv_content(file_content)

expected_headers = ["Account", "Date", "Description", "Reference", "Amount", "Fees", "Balance"]
expected_headers = [
"Account",
"Date",
"Description",
"Reference",
"Amount",
"Fees",
"Balance",
]
if data[2][:7] != expected_headers:
frappe.throw(_("Unexpected headers in CSV. Expected: {0}").format(", ".join(expected_headers)))
if not data:
Expand All @@ -214,7 +222,8 @@ def parse_csv_file_capitec(self, file_doc):
new_data.append(new_row)

# Create a new row if this row has a fee
if row[5] != None:
print(f"\n\n{row[5]}\n\n")
if row[5] != None and float(row[5]) != 0:
try:
fee_value = float(row[5])
except ValueError:
Expand Down