Browse Source

Support zip files.

pull/134/head
Ronald Portier (Therp BV) 10 years ago
committed by Andrea
parent
commit
c53c5423f0
  1. 2
      account_bank_statement_import_camt/__manifest__.py
  2. 9
      account_bank_statement_import_camt/camt.py
  3. 30
      account_bank_statement_import_camt/test_files/test-camt053.xml
  4. BIN
      account_bank_statement_import_camt/test_files/test-camt053.zip
  5. 11
      account_bank_statement_import_camt/tests/test_import_bank_statement.py

2
account_bank_statement_import_camt/__manifest__.py

@ -19,7 +19,7 @@
##############################################################################
{
'name': 'CAMT Format Bank Statements Import',
'version': '8.0.0.3.0',
'version': '8.0.0.4.0',
'license': 'AGPL-3',
'author': 'Odoo Community Association (OCA), Therp BV',
'website': 'https://github.com/OCA/bank-statement-import',

9
account_bank_statement_import_camt/camt.py

@ -69,7 +69,7 @@ class CamtParser(object):
'./ns:RmtInf/ns:Ustrd',
'./ns:AddtlTxInf',
'./ns:AddtlNtryInf',
], transaction, 'message')
], transaction, 'message', join_str='\n')
# eref
self.add_value_from_node(
ns, node, [
@ -137,6 +137,13 @@ class CamtParser(object):
if not transaction.message:
self.add_value_from_node(
ns, node, './ns:AddtlNtryInf', transaction, 'message')
if not transaction.eref:
self.add_value_from_node(
ns, node, [
'./ns:NtryDtls/ns:Btch/ns:PmtInfId',
],
transaction, 'eref'
)
transaction.data = etree.tostring(node)
return transaction

30
account_bank_statement_import_camt/test_files/test-camt053.xml

@ -2,15 +2,15 @@
<BkToCstmrStmt>
<GrpHdr>
<MsgId>TESTBANK/NL/1420561226673</MsgId>
<CreDtTm>2013-01-06T16:20:26.673Z</CreDtTm>
<CreDtTm>2014-01-06T16:20:26.673Z</CreDtTm>
</GrpHdr>
<Stmt>
<Id>1234Test/1</Id>
<LglSeqNb>2</LglSeqNb>
<CreDtTm>2013-01-06T16:20:26.673Z</CreDtTm>
<CreDtTm>2014-01-06T16:20:26.673Z</CreDtTm>
<FrToDt>
<FrDtTm>2013-01-05T00:00:00.000Z</FrDtTm>
<ToDtTm>2013-01-05T23:59:59.999Z</ToDtTm>
<FrDtTm>2014-01-05T00:00:00.000Z</FrDtTm>
<ToDtTm>2014-01-05T23:59:59.999Z</ToDtTm>
</FrToDt>
<Acct>
<Id>
@ -32,7 +32,7 @@
<Amt Ccy="EUR">15568.27</Amt>
<CdtDbtInd>CRDT</CdtDbtInd>
<Dt>
<Dt>2013-01-05</Dt>
<Dt>2014-01-05</Dt>
</Dt>
</Bal>
<Bal>
@ -44,7 +44,7 @@
<Amt Ccy="EUR">15121.12</Amt>
<CdtDbtInd>CRDT</CdtDbtInd>
<Dt>
<Dt>2013-01-05</Dt>
<Dt>2014-01-05</Dt>
</Dt>
</Bal>
<Ntry>
@ -52,10 +52,10 @@
<CdtDbtInd>DBIT</CdtDbtInd>
<Sts>BOOK</Sts>
<BookgDt>
<Dt>2013-01-05</Dt>
<Dt>2014-01-05</Dt>
</BookgDt>
<ValDt>
<Dt>2013-01-05</Dt>
<Dt>2014-01-05</Dt>
</ValDt>
<BkTxCd>
<Domn>
@ -104,9 +104,9 @@
</CdtrAgt>
</RltdAgts>
<RmtInf>
<Ustrd>Insurance policy 857239PERIOD 01.01.2013 - 31.12.2013</Ustrd>
<Ustrd>Insurance policy 857239PERIOD 01.01.2014 - 31.12.2014</Ustrd>
</RmtInf>
<AddtlTxInf>MKB Insurance 859239PERIOD 01.01.2013 - 31.12.2013</AddtlTxInf>
<AddtlTxInf>MKB Insurance 859239PERIOD 01.01.2014 - 31.12.2014</AddtlTxInf>
</TxDtls>
</NtryDtls>
</Ntry>
@ -116,10 +116,10 @@
<RvslInd>true</RvslInd>
<Sts>BOOK</Sts>
<BookgDt>
<Dt>2013-01-05</Dt>
<Dt>2014-01-05</Dt>
</BookgDt>
<ValDt>
<Dt>2013-01-05</Dt>
<Dt>2014-01-05</Dt>
</ValDt>
<BkTxCd>
<Domn>
@ -182,10 +182,10 @@
<CdtDbtInd>CRDT</CdtDbtInd>
<Sts>BOOK</Sts>
<BookgDt>
<Dt>2013-01-05</Dt>
<Dt>2014-01-05</Dt>
</BookgDt>
<ValDt>
<Dt>2013-01-05</Dt>
<Dt>2014-01-05</Dt>
</ValDt>
<BkTxCd>
<Domn>
@ -202,7 +202,7 @@
<NtryDtls>
<TxDtls>
<Refs>
<InstrId>INNDNL2U20130105000217200000708</InstrId>
<InstrId>INNDNL2U20140105000217200000708</InstrId>
<EndToEndId>115</EndToEndId>
</Refs>
<AmtDtls>

BIN
account_bank_statement_import_camt/test_files/test-camt053.zip

11
account_bank_statement_import_camt/tests/test_import_bank_statement.py

@ -31,11 +31,10 @@ class TestImport(TestStatementFile):
{
'remote_account': 'NL46ABNA0499998748',
'transferred_amount': -754.25,
'value_date': '2013-01-05',
'value_date': '2014-01-05',
'ref': '435005714488-ABNO33052620',
},
]
# statement name is account number + '-' + date of last 62F line:
self._test_statement_import(
'account_bank_statement_import_camt', 'test-camt053.xml',
'1234Test/1',
@ -43,3 +42,11 @@ class TestImport(TestStatementFile):
start_balance=15568.27, end_balance=15121.12,
transactions=transactions
)
def test_zip_import(self):
"""Test import of multiple statements from zip file."""
self._test_statement_import(
'account_bank_statement_import_camt', 'test-camt053.zip',
'1234Test/2', # Only name of first statement
local_account='NL77ABNA0574908765',
)
Loading…
Cancel
Save