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 (grafted from ed04c2b28dce1439020b014ea47277dcb4aa22be) --HG-- branch : 7.0
This commit is contained in:
1 parent
8acfbc2560
commit
3ad6a6a976
2 files changed
+12
-4
No files matched your search
@@ -79,9 +79,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
|
||||
|
||||
@@ -152,7 +155,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)
|
||||
|
||||
@@ -109,6 +109,11 @@
|
||||
</BkTxCd>
|
||||
<NtryDtls>
|
||||
<TxDtls>
|
||||
<AmtDtls>
|
||||
<TxAmt>
|
||||
<Amt Ccy="EUR">100.00</Amt>
|
||||
</TxAmt>
|
||||
</AmtDtls>
|
||||
<RltdPties>
|
||||
<Cdtr>
|
||||
<Pty>
|
||||
|
||||
Reference in new issue
Block a user