From fb7b2b2c415e2995a1393972757c22692e425928 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Sun, 17 Sep 2023 15:54:38 +0200 Subject: [PATCH] Fix journal matching for CAMT files from e.g. Commerzbank --- account_statement_import_camt/models/parser.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/account_statement_import_camt/models/parser.py b/account_statement_import_camt/models/parser.py index 15b526739..d914dc166 100644 --- a/account_statement_import_camt/models/parser.py +++ b/account_statement_import_camt/models/parser.py @@ -393,6 +393,10 @@ def parse_statement(self, ns, node): result, "currency", ) + # COMMERZBANK adds the currency as the last 3 digits of the bank account number + # hence we need to remove this since otherwise the journal matching logic fails + if result["account_number"][-3:] == result["currency"]: + result["account_number"] = result["account_number"][:-3] result["balance_start"], result["balance_end_real"] = self.get_balance_amounts( ns, node )