Browse Source

[8.0][FIX] account_bank_statement_import_camt: payment amounts (#169)

pull/77/head
Tom 6 years ago
committed by Pedro M. Baeza
parent
commit
436bf35252
  1. 2
      account_bank_statement_import_camt/__openerp__.py
  2. 6
      account_bank_statement_import_camt/models/parser.py
  3. 50
      account_bank_statement_import_camt/test_files/test-camt053.xml
  4. 18
      account_bank_statement_import_camt/tests/test_import_bank_statement.py

2
account_bank_statement_import_camt/__openerp__.py

@ -19,7 +19,7 @@
##############################################################################
{
'name': 'CAMT Format Bank Statements Import',
'version': '8.0.0.4.0',
'version': '8.0.0.4.1',
'summary': 'Module to import SEPA CAMT.053 Format bank statement files',
'license': 'AGPL-3',
'author': 'Odoo Community Association (OCA), Therp BV',

6
account_bank_statement_import_camt/models/parser.py

@ -44,9 +44,15 @@ class CamtParser(models.AbstractModel):
sign = 1
amount = 0.0
sign_node = node.xpath('ns:CdtDbtInd', namespaces={'ns': ns})
if not sign_node:
sign_node = node.xpath(
'../../ns:CdtDbtInd', namespaces={'ns': ns})
if sign_node and sign_node[0].text == 'DBIT':
sign = -1
amount_node = node.xpath('ns:Amt', namespaces={'ns': ns})
if not amount_node:
amount_node = node.xpath(
'./ns:AmtDtls/ns:TxAmt/ns:Amt', namespaces={'ns': ns})
if amount_node:
amount = sign * float(amount_node[0].text)
return amount

50
account_bank_statement_import_camt/test_files/test-camt053.xml

@ -111,7 +111,7 @@
</NtryDtls>
</Ntry>
<Ntry>
<Amt Ccy="EUR">594.05</Amt>
<Amt Ccy="EUR">664.05</Amt>
<CdtDbtInd>DBIT</CdtDbtInd>
<RvslInd>true</RvslInd>
<Sts>BOOK</Sts>
@ -134,6 +134,13 @@
</Prtry>
</BkTxCd>
<NtryDtls>
<Btch>
<MsgId>2014/125</MsgId>
<PmtInfId>2018/125-20141229-NORM</PmtInfId>
<NbOfTxs>2</NbOfTxs>
<TtlAmt Ccy="EUR">664.05</TtlAmt>
<CdtDbtInd>DBIT</CdtDbtInd>
</Btch>
<TxDtls>
<Refs>
<InstrId>TESTBANK/NL/20141229/01206408</InstrId>
@ -175,6 +182,47 @@
</RtrInf>
<AddtlTxInf>Direct debit S14 0410 AC07 Rek.nummer blokkade TESTBANK/NL/20141229/01206408</AddtlTxInf>
</TxDtls>
<TxDtls>
<Refs>
<InstrId>TESTBANK/NL/20141229/01206407</InstrId>
<EndToEndId>TESTBANK/NL/20141229/01206407</EndToEndId>
<MndtId>NL22ZZZ524885430000-C0125.2</MndtId>
</Refs>
<AmtDtls>
<TxAmt>
<Amt Ccy="EUR">100.00</Amt>
</TxAmt>
</AmtDtls>
<RltdPties>
<Cdtr>
<Nm>Test Customer</Nm>
<PstlAdr>
<Ctry>NL</Ctry>
</PstlAdr>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>NL46ABNA0499998748</IBAN>
</Id>
</CdtrAcct>
</RltdPties>
<RltdAgts>
<CdtrAgt>
<FinInstnId>
<BIC>ABNANL2A</BIC>
</FinInstnId>
</CdtrAgt>
</RltdAgts>
<RmtInf>
<Ustrd>Direct Debit S14 0410</Ustrd>
</RmtInf>
<RtrInf>
<Rsn>
<Cd>AC06</Cd>
</Rsn>
</RtrInf>
<AddtlTxInf>Direct debit S14 0410 AC07 Rek.nummer blokkade TESTBANK/NL/20141229/01206408</AddtlTxInf>
</TxDtls>
</NtryDtls>
</Ntry>
<Ntry>

18
account_bank_statement_import_camt/tests/test_import_bank_statement.py

@ -34,6 +34,24 @@ class TestImport(TestStatementFile):
'value_date': '2014-01-05',
'ref': '435005714488-ABNO33052620',
},
{
'remote_account': 'NL46ABNA0499998748',
'transferred_amount': -564.05,
'value_date': '2014-01-05',
'ref': 'TESTBANK/NL/20141229/01206408',
},
{
'remote_account': 'NL46ABNA0499998748',
'transferred_amount': -100.0,
'value_date': '2014-01-05',
'ref': 'TESTBANK/NL/20141229/01206407',
},
{
'remote_account': 'NL69ABNA0522123643',
'transferred_amount': 1405.31,
'value_date': '2014-01-05',
'ref': '115',
},
]
self._test_statement_import(
'account_bank_statement_import_camt', 'test-camt053.xml',

Loading…
Cancel
Save