add operation real date as metadata
This commit is contained in:
parent
46b2e632b6
commit
0d3db7811b
|
@ -16,6 +16,7 @@ COL_LABEL = "Libelle simplifie"
|
|||
COL_DEBIT = "Debit"
|
||||
COL_CREDIT = "Credit"
|
||||
COL_DETAIL = "Informations complementaires"
|
||||
COL_DATE_OP = "Date operation"
|
||||
|
||||
END_DATE_REGEX = "Date de fin de téléchargement : ([0-3][0-9]/[0-1][0-9]/[0-9]{4})"
|
||||
START_DATE_REGEX = "Date de début de téléchargement : ([0-3][0-9]/[0-1][0-9]/[0-9]{4})"
|
||||
|
@ -58,9 +59,7 @@ class CDEImporter(importer.ImporterProtocol):
|
|||
if row is None:
|
||||
return None
|
||||
|
||||
return datetime.strptime(
|
||||
row[COL_DATE], "%d/%m/%Y"
|
||||
).date()
|
||||
return datetime.strptime(row[COL_DATE], "%d/%m/%Y").date()
|
||||
|
||||
def extract(self, file: cache._FileMemo, existing_entries=None) -> list[Any]:
|
||||
directives: list[Any] = []
|
||||
|
@ -74,9 +73,8 @@ class CDEImporter(importer.ImporterProtocol):
|
|||
lineno: int = index + 2 # entries start at line 2
|
||||
meta = data.new_metadata(file.name, lineno)
|
||||
|
||||
transaction_date: date = datetime.strptime(
|
||||
row[COL_DATE], "%d/%m/%Y"
|
||||
).date()
|
||||
transaction_date: date = datetime.strptime(row[COL_DATE], "%d/%m/%Y").date()
|
||||
op_date: date = datetime.strptime(row[COL_DATE_OP], "%d/%m/%Y").date()
|
||||
label: str = row[COL_LABEL]
|
||||
debit: str = row[COL_DEBIT]
|
||||
credit: str = row[COL_CREDIT]
|
||||
|
@ -88,7 +86,12 @@ class CDEImporter(importer.ImporterProtocol):
|
|||
amount = Decimal(debit.replace(",", "."))
|
||||
postings.append(
|
||||
data.Posting(
|
||||
self.account, Amount(amount, "EUR"), None, None, None, None
|
||||
self.account,
|
||||
Amount(amount, "EUR"),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -96,10 +99,17 @@ class CDEImporter(importer.ImporterProtocol):
|
|||
amount = Decimal(credit.replace(",", "."))
|
||||
postings.append(
|
||||
data.Posting(
|
||||
self.account, Amount(amount, "EUR"), None, None, None, None
|
||||
self.account,
|
||||
Amount(amount, "EUR"),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
)
|
||||
|
||||
meta["op_date"] = op_date
|
||||
|
||||
directives.append(
|
||||
data.Transaction(
|
||||
meta,
|
||||
|
|
Loading…
Reference in a new issue