From a4a376e8088dc2afe5f4a713cbb28f069a62e052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 1 Feb 2026 19:01:49 +0100 Subject: [PATCH] Use amount from transaction details when available A batched transaction may have many details and amounts that are grouped as the entry amount. Closes #13823 --- modules/account_statement_sepa/account.py | 11 +++++++---- .../account_statement_sepa/tests/camt.053.001.02.xml | 5 +++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/account_statement_sepa/account.py b/modules/account_statement_sepa/account.py index 88729402b1..e5b1417739 100644 --- a/modules/account_statement_sepa/account.py +++ b/modules/account_statement_sepa/account.py @@ -72,9 +72,12 @@ class StatementImport(metaclass=PoolMeta): statement.total_amount = self.camt_statement_total(camt_statement) return statement - def _camt_amount(self, node): - amount = Decimal(node.findtext('./{*}Amt')) - if node.findtext('./{*}CdtDbtInd') == 'DBIT': + def _camt_amount(self, entry, detail=None): + if detail is not None: + amount = Decimal(detail.findtext('./{*}AmtDtls/{*}TxAmt/{*}Amt')) + else: + amount = Decimal(entry.findtext('./{*}Amt')) + if entry.findtext('./{*}CdtDbtInd') == 'DBIT': amount *= -1 return amount @@ -145,7 +148,7 @@ class StatementImport(metaclass=PoolMeta): elif booking_date.find('./{*}DtTm') is not None: origin.date = dt.date.fromisoformat( booking_date.findtext('./{*}DtTm')).date() - origin.amount = self._camt_amount(entry) + origin.amount = self._camt_amount(entry, detail) origin.description = self.camt_description(camt_statement, entry) if detail is not None: origin.party = self.camt_party(camt_statement, entry, detail) diff --git a/modules/account_statement_sepa/tests/camt.053.001.02.xml b/modules/account_statement_sepa/tests/camt.053.001.02.xml index 784984628b..65163f5c73 100644 --- a/modules/account_statement_sepa/tests/camt.053.001.02.xml +++ b/modules/account_statement_sepa/tests/camt.053.001.02.xml @@ -109,6 +109,11 @@ + + + 100.00 + +