mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[IMP] account_statement_import_camt: look for currency under Ntry
Encountered in a Camt.054 statement: currency listed under /BkToCstmrDbtCdtNtfctn/Ntfctn/Ntry/Amt/@Ccy
This commit is contained in:
@@ -204,7 +204,15 @@ class CamtParser(models.AbstractModel):
|
|||||||
)
|
)
|
||||||
self.add_value_from_node(ns, node, "./ns:Id", result, "name")
|
self.add_value_from_node(ns, node, "./ns:Id", result, "name")
|
||||||
self.add_value_from_node(
|
self.add_value_from_node(
|
||||||
ns, node, ["./ns:Acct/ns:Ccy", "./ns:Bal/ns:Amt/@Ccy"], result, "currency"
|
ns,
|
||||||
|
node,
|
||||||
|
[
|
||||||
|
"./ns:Acct/ns:Ccy",
|
||||||
|
"./ns:Bal/ns:Amt/@Ccy",
|
||||||
|
"./ns:Ntry/ns:Amt/@Ccy",
|
||||||
|
],
|
||||||
|
result,
|
||||||
|
"currency",
|
||||||
)
|
)
|
||||||
result["balance_start"], result["balance_end_real"] = self.get_balance_amounts(
|
result["balance_start"], result["balance_end_real"] = self.get_balance_amounts(
|
||||||
ns, node
|
ns, node
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
* Holger Brunn <hbrunn@therp.nl>
|
* Holger Brunn <hbrunn@therp.nl>
|
||||||
* Stefan Rijnhart <srijnhart@therp.nl>
|
* Stefan Rijnhart <stefan.rijnhart@opener.amsterdam>
|
||||||
* Ronald Portier <rportier@therp.nl>
|
* Ronald Portier <rportier@therp.nl>
|
||||||
* Andrea Stirpe <a.stirpe@onestein.nl>
|
* Andrea Stirpe <a.stirpe@onestein.nl>
|
||||||
* Maxence Groine <mgroine@fiefmanage.ch>
|
* Maxence Groine <mgroine@fiefmanage.ch>
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
('EUR',
|
||||||
|
'NL77ABNA0574908765',
|
||||||
|
[{'balance_end_real': 0.0,
|
||||||
|
'balance_start': 0.0,
|
||||||
|
'date': '2022-01-26',
|
||||||
|
'name': '20220120000000000000000',
|
||||||
|
'transactions': [{'account_number': 'NL46ABNA0499998748',
|
||||||
|
'amount': 5.0,
|
||||||
|
'date': '2022-01-26',
|
||||||
|
'narration': 'Additional entry info',
|
||||||
|
'partner_name': 'Test Customer',
|
||||||
|
'payment_ref': 'MIB InstrId305-312MM20211231v1',
|
||||||
|
'ref': '000000000000000000000000003'}]}])
|
||||||
127
account_statement_import_camt/test_files/test-camt054
Normal file
127
account_statement_import_camt/test_files/test-camt054
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.054.001.04" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:camt.054.001.04 camt.054.001.04.xsd">
|
||||||
|
<BkToCstmrDbtCdtNtfctn>
|
||||||
|
<GrpHdr>
|
||||||
|
<MsgId>20220126375204763458853</MsgId>
|
||||||
|
<CreDtTm>2022-01-26T23:40:40</CreDtTm>
|
||||||
|
<MsgPgntn>
|
||||||
|
<PgNb>1</PgNb>
|
||||||
|
<LastPgInd>true</LastPgInd>
|
||||||
|
</MsgPgntn>
|
||||||
|
<AddtlInf>SPS/1.7/PROD</AddtlInf>
|
||||||
|
</GrpHdr>
|
||||||
|
<Ntfctn>
|
||||||
|
<Id>20220120000000000000000</Id>
|
||||||
|
<CreDtTm>2022-01-26T23:40:40</CreDtTm>
|
||||||
|
<FrToDt>
|
||||||
|
<FrDtTm>2022-01-26T00:00:00</FrDtTm>
|
||||||
|
<ToDtTm>2022-01-26T23:59:59</ToDtTm>
|
||||||
|
</FrToDt>
|
||||||
|
<RptgSrc>
|
||||||
|
<Prtry>OTHR</Prtry>
|
||||||
|
</RptgSrc>
|
||||||
|
<Acct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>NL77ABNA0574908765</IBAN>
|
||||||
|
</Id>
|
||||||
|
<Ownr>
|
||||||
|
<Nm>Example company</Nm>
|
||||||
|
</Ownr>
|
||||||
|
</Acct>
|
||||||
|
<Ntry>
|
||||||
|
<NtryRef>NL0000000000000000000</NtryRef>
|
||||||
|
<Amt Ccy="EUR">5.00</Amt>
|
||||||
|
<CdtDbtInd>CRDT</CdtDbtInd>
|
||||||
|
<RvslInd>false</RvslInd>
|
||||||
|
<Sts>BOOK</Sts>
|
||||||
|
<BookgDt>
|
||||||
|
<Dt>2022-01-26</Dt>
|
||||||
|
</BookgDt>
|
||||||
|
<ValDt>
|
||||||
|
<Dt>2022-01-26</Dt>
|
||||||
|
</ValDt>
|
||||||
|
<AcctSvcrRef>98888208N8</AcctSvcrRef>
|
||||||
|
<BkTxCd>
|
||||||
|
<Domn>
|
||||||
|
<Cd>PMNT</Cd>
|
||||||
|
<Fmly>
|
||||||
|
<Cd>RCDT</Cd>
|
||||||
|
<SubFmlyCd>VCOM</SubFmlyCd>
|
||||||
|
</Fmly>
|
||||||
|
</Domn>
|
||||||
|
</BkTxCd>
|
||||||
|
<NtryDtls>
|
||||||
|
<Btch>
|
||||||
|
<NbOfTxs>1</NbOfTxs>
|
||||||
|
</Btch>
|
||||||
|
<TxDtls>
|
||||||
|
<Refs>
|
||||||
|
<AcctSvcrRef>15180015077602405</AcctSvcrRef>
|
||||||
|
<InstrId>MIB InstrId305-312MM20211231v1</InstrId>
|
||||||
|
<EndToEndId>ENDTOENDID-01</EndToEndId>
|
||||||
|
<Prtry>
|
||||||
|
<Tp>00</Tp>
|
||||||
|
<Ref>20220120000000000000001</Ref>
|
||||||
|
</Prtry>
|
||||||
|
</Refs>
|
||||||
|
<Amt Ccy="EUR">5.00</Amt>
|
||||||
|
<CdtDbtInd>CRDT</CdtDbtInd>
|
||||||
|
<BkTxCd>
|
||||||
|
<Domn>
|
||||||
|
<Cd>PMNT</Cd>
|
||||||
|
<Fmly>
|
||||||
|
<Cd>RCDT</Cd>
|
||||||
|
<SubFmlyCd>ATXN</SubFmlyCd>
|
||||||
|
</Fmly>
|
||||||
|
</Domn>
|
||||||
|
</BkTxCd>
|
||||||
|
<RltdPties>
|
||||||
|
<Dbtr>
|
||||||
|
<Nm>Test Customer</Nm>
|
||||||
|
<PstlAdr>
|
||||||
|
<AdrLine>Test street 1</AdrLine>
|
||||||
|
<AdrLine>1234 AB Test city</AdrLine>
|
||||||
|
</PstlAdr>
|
||||||
|
</Dbtr>
|
||||||
|
<DbtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>NL46ABNA0499998748</IBAN>
|
||||||
|
</Id>
|
||||||
|
</DbtrAcct>
|
||||||
|
</RltdPties>
|
||||||
|
<RltdAgts>
|
||||||
|
<DbtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<ClrSysMmbId>
|
||||||
|
<MmbId>NZNCC020368</MmbId>
|
||||||
|
</ClrSysMmbId>
|
||||||
|
<Nm>Test Bank</Nm>
|
||||||
|
<PstlAdr>
|
||||||
|
<AdrLine>Test street 5</AdrLine>
|
||||||
|
<AdrLine>1234 AB Test city</AdrLine>
|
||||||
|
</PstlAdr>
|
||||||
|
</FinInstnId>
|
||||||
|
</DbtrAgt>
|
||||||
|
</RltdAgts>
|
||||||
|
<RmtInf>
|
||||||
|
<Strd>
|
||||||
|
<CdtrRefInf>
|
||||||
|
<Tp>
|
||||||
|
<CdOrPrtry>
|
||||||
|
<Prtry>QRR</Prtry>
|
||||||
|
</CdOrPrtry>
|
||||||
|
</Tp>
|
||||||
|
<Ref>000000000000000000000000003</Ref>
|
||||||
|
</CdtrRefInf>
|
||||||
|
</Strd>
|
||||||
|
</RmtInf>
|
||||||
|
<RltdDts>
|
||||||
|
<AccptncDtTm>2022-01-26T20:00:00</AccptncDtTm>
|
||||||
|
</RltdDts>
|
||||||
|
</TxDtls>
|
||||||
|
</NtryDtls>
|
||||||
|
<AddtlNtryInf>Additional entry info</AddtlNtryInf>
|
||||||
|
</Ntry>
|
||||||
|
</Ntfctn>
|
||||||
|
</BkToCstmrDbtCdtNtfctn>
|
||||||
|
</Document>
|
||||||
@@ -46,6 +46,9 @@ class TestParser(TransactionCase):
|
|||||||
def test_parse(self):
|
def test_parse(self):
|
||||||
self._do_parse_test("test-camt053", "golden-camt053.pydata")
|
self._do_parse_test("test-camt053", "golden-camt053.pydata")
|
||||||
|
|
||||||
|
def test_parse_camt054(self):
|
||||||
|
self._do_parse_test("test-camt054", "golden-camt054.pydata")
|
||||||
|
|
||||||
def test_parse_txdtls(self):
|
def test_parse_txdtls(self):
|
||||||
self._do_parse_test("test-camt053-txdtls", "golden-camt053-txdtls.pydata")
|
self._do_parse_test("test-camt053-txdtls", "golden-camt053-txdtls.pydata")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user