From 6d6e281b0ab733f320d8081fbcfcfa43101f08e8 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Thu, 10 Nov 2022 19:27:58 +0100 Subject: [PATCH] add CE category as metadata --- beancount_cde_importer/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/beancount_cde_importer/__init__.py b/beancount_cde_importer/__init__.py index 76d40d3..9738226 100644 --- a/beancount_cde_importer/__init__.py +++ b/beancount_cde_importer/__init__.py @@ -17,6 +17,8 @@ COL_DEBIT = "Debit" COL_CREDIT = "Credit" COL_DETAIL = "Informations complementaires" COL_DATE_OP = "Date operation" +COL_CATEGORY = "Categorie" +COL_SUBCATEGORY = "Sous categorie" 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})" @@ -75,6 +77,8 @@ class CDEImporter(importer.ImporterProtocol): 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() + category: str = row[COL_CATEGORY] + subcategory: str = row[COL_SUBCATEGORY] label: str = row[COL_LABEL] debit: str = row[COL_DEBIT] credit: str = row[COL_CREDIT] @@ -109,6 +113,7 @@ class CDEImporter(importer.ImporterProtocol): ) meta["op_date"] = op_date + meta["ce_category"] = f"{category} - {subcategory}" directives.append( data.Transaction(