handle start date balance

This commit is contained in:
Antoine Martin 2022-02-05 19:50:59 +01:00
parent 98335d1de7
commit 63da72c7c6

View file

@ -126,6 +126,23 @@ class CaisseDEpargneImporter(importer.ImporterProtocol):
for index, row in enumerate(csv_reader):
lineno: int = index + 6 # entries start at line 6
meta = data.new_metadata(file.name, lineno)
if row[0] == "Solde en début de période":
balance = Decimal(row[4].replace(",", "."))
directives.append(
data.Balance(
meta=meta,
date=start_date,
account=self.account,
amount=Amount(balance, "EUR"),
tolerance=None,
diff_amount=None,
)
)
# should be the last line anyway
continue
transaction_date: date = datetime.strptime(
row[INDEX_DATE], "%d/%m/%y"
).date()