Commit 23731d8b authored by Thomasa Balthazar's avatar Thomasa Balthazar
Browse files

Strip bank_id's last char

CSV import create duplicate entries because it relies and the `bank_id`
field to always be the same for a transaction, across exports.

Observations show a transaction always has the same `bank_id` across
exports, **except** for the last char. I haven't found any documentation
about the CSV/bank_id format but looking a the duplicate entries we have
in the database and at entries from a couple of difference CSV exports,
it should fix our issue.
parent 145106c9
......@@ -33,7 +33,7 @@ def handle_recordbank_csv(csv_file):
with transaction.atomic():
for entry in csv.DictReader(StringIO("\r\n".join(csv_file.read().split("\n")[1:]) + "\r\n"), delimiter=";"):
movement = Movement()
movement.bank_id = fr_or_nl(entry, "Ref. v/d verrichting")
movement.bank_id = fr_or_nl(entry, "Ref. v/d verrichting")[:-1]
movement.date = datetime.strptime(fr_or_nl(entry, "Datum v. verrichting"), "%d-%m-%Y").date()
movement.amount = float(fr_or_nl(entry, "Bedrag v/d verrichting").replace(".", "").replace(",", "."))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment