first commit
This commit is contained in:
2
modules/account_statement_sepa/tests/__init__.py
Normal file
2
modules/account_statement_sepa/tests/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
144
modules/account_statement_sepa/tests/camt.053.001.02.xml
Normal file
144
modules/account_statement_sepa/tests/camt.053.001.02.xml
Normal file
@@ -0,0 +1,144 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:iso:std:iso:20022:tech:xsd:camt.053.001.02">
|
||||
<BkToCstmrStmt>
|
||||
<GrpHdr>
|
||||
<MsgId>Example</MsgId>
|
||||
<CreDtTm>2009-05-12T00:00:00</CreDtTm>
|
||||
<MsgRcpt>
|
||||
<Nm>Name Recipient</Nm>
|
||||
</MsgRcpt>
|
||||
<MsgPgntn>
|
||||
<PgNb>1</PgNb>
|
||||
<LastPgInd>YES</LastPgInd>
|
||||
</MsgPgntn>
|
||||
</GrpHdr>
|
||||
<Stmt>
|
||||
<Id>Example_2009-05-12T00:00:00</Id>
|
||||
<ElctrncSeqNb>128</ElctrncSeqNb>
|
||||
<LglSeqNb>130</LglSeqNb>
|
||||
<CreDtTm>2009-05-12T00:00:00</CreDtTm>
|
||||
<FrToDt>
|
||||
<FrDtTm>2009-04-29T00:00:00</FrDtTm>
|
||||
<ToDtTm>2009-04-29T00:00:00</ToDtTm>
|
||||
</FrToDt>
|
||||
<Acct>
|
||||
<Id>
|
||||
<IBAN>BE55442968847144</IBAN>
|
||||
</Id>
|
||||
<Tp>
|
||||
<Prtry>Account Type</Prtry>
|
||||
</Tp>
|
||||
<Ccy>EUR</Ccy>
|
||||
<Ownr>
|
||||
<Nm>Name Accountowner</Nm>
|
||||
<Id>
|
||||
<OrgId>
|
||||
<Othr>
|
||||
<Id>00462920226</Id>
|
||||
</Othr>
|
||||
</OrgId>
|
||||
</Id>
|
||||
</Ownr>
|
||||
<Svcr>
|
||||
<FinInstnId>
|
||||
<BIC>ABANKBEB</BIC>
|
||||
</FinInstnId>
|
||||
</Svcr>
|
||||
</Acct>
|
||||
<Bal>
|
||||
<Tp>
|
||||
<CdOrPrtry>
|
||||
<Cd>OPBD</Cd>
|
||||
</CdOrPrtry>
|
||||
</Tp>
|
||||
<Amt Ccy="EUR">2000.00</Amt>
|
||||
<CdtDbtInd>CRDT</CdtDbtInd>
|
||||
<Dt>
|
||||
<Dt>2009-04-28</Dt>
|
||||
</Dt>
|
||||
</Bal>
|
||||
<Bal>
|
||||
<Tp>
|
||||
<CdOrPrtry>
|
||||
<Cd>CLBD</Cd>
|
||||
</CdOrPrtry>
|
||||
</Tp>
|
||||
<Amt Ccy="EUR">1900.00</Amt>
|
||||
<CdtDbtInd>CRDT</CdtDbtInd>
|
||||
<Dt>
|
||||
<Dt>2009-04-29</Dt>
|
||||
</Dt>
|
||||
</Bal>
|
||||
<TxsSummry>
|
||||
<TtlNtries>
|
||||
<NbOfNtries>1</NbOfNtries>
|
||||
<Sum>6852.79</Sum>
|
||||
<TtlNetNtry>
|
||||
<Amt>100.00</Amt>
|
||||
<CdtDbtInd>DBIT</CdtDbtInd>
|
||||
</TtlNetNtry>
|
||||
</TtlNtries>
|
||||
<TtlCdtNtries>
|
||||
<NbOfNtries>1</NbOfNtries>
|
||||
<Sum>1024.03</Sum>
|
||||
</TtlCdtNtries>
|
||||
</TxsSummry>
|
||||
<Ntry>
|
||||
<Amt Ccy="EUR">100.00</Amt>
|
||||
<CdtDbtInd>DBIT</CdtDbtInd>
|
||||
<Sts>BOOK</Sts>
|
||||
<BookgDt>
|
||||
<Dt>2009-04-29</Dt>
|
||||
</BookgDt>
|
||||
<ValDt>
|
||||
<Dt>2009-04-25</Dt>
|
||||
</ValDt>
|
||||
<AcctSvcrRef>Bank Reference</AcctSvcrRef>
|
||||
<BkTxCd>
|
||||
<Domn>
|
||||
<Cd>PMNT</Cd>
|
||||
<Fmly>
|
||||
<Cd>ICDT</Cd>
|
||||
<SubFmlyCd>ESCT</SubFmlyCd>
|
||||
</Fmly>
|
||||
</Domn>
|
||||
<Prtry>
|
||||
<Cd>0101000</Cd>
|
||||
<Issr>BBA</Issr>
|
||||
</Prtry>
|
||||
</BkTxCd>
|
||||
<NtryDtls>
|
||||
<TxDtls>
|
||||
<AmtDtls>
|
||||
<TxAmt>
|
||||
<Amt Ccy="EUR">100.00</Amt>
|
||||
</TxAmt>
|
||||
</AmtDtls>
|
||||
<RltdPties>
|
||||
<Cdtr>
|
||||
<Pty>
|
||||
<Nm>Supplier</Nm>
|
||||
</Pty>
|
||||
</Cdtr>
|
||||
<CdtrAcct>
|
||||
<Id>
|
||||
<IBAN>DE79370400440123619900</IBAN>
|
||||
</Id>
|
||||
</CdtrAcct>
|
||||
</RltdPties>
|
||||
<RltdAgts>
|
||||
<CdtrAgt>
|
||||
<FinInstnId>
|
||||
<BIC>COBADEFF370</BIC>
|
||||
</FinInstnId>
|
||||
</CdtrAgt>
|
||||
</RltdAgts>
|
||||
<RmtInf>
|
||||
<Ustrd>INV 2150135</Ustrd>
|
||||
</RmtInf>
|
||||
</TxDtls>
|
||||
</NtryDtls>
|
||||
</Ntry>
|
||||
</Stmt>
|
||||
</BkToCstmrStmt>
|
||||
</Document>
|
||||
@@ -0,0 +1,114 @@
|
||||
===============================
|
||||
Account Statement Sepa Scenario
|
||||
===============================
|
||||
|
||||
Imports::
|
||||
|
||||
>>> from functools import partial
|
||||
|
||||
>>> from proteus import Model, Wizard
|
||||
>>> from trytond.modules.account.tests.tools import create_chart, get_accounts
|
||||
>>> from trytond.modules.company.tests.tools import create_company, get_company
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.tools import file_open
|
||||
|
||||
Activate modules::
|
||||
|
||||
>>> config = activate_modules(
|
||||
... 'account_statement_sepa',
|
||||
... partial(create_company, currency='EUR'), create_chart)
|
||||
|
||||
>>> AccountJournal = Model.get('account.journal')
|
||||
>>> Bank = Model.get('bank')
|
||||
>>> BankAccount = Model.get('bank.account')
|
||||
>>> Party = Model.get('party.party')
|
||||
>>> StatementJournal = Model.get('account.statement.journal')
|
||||
|
||||
Get company::
|
||||
|
||||
>>> company = get_company()
|
||||
|
||||
Get accounts::
|
||||
|
||||
>>> accounts = get_accounts()
|
||||
|
||||
Create parties::
|
||||
|
||||
>>> supplier = Party(name="Supplier")
|
||||
>>> supplier.save()
|
||||
>>> bank_party = Party(name="Bank")
|
||||
>>> bank_party.save()
|
||||
|
||||
Create Bank Accounts::
|
||||
|
||||
>>> bank = Bank()
|
||||
>>> bank.party = bank_party
|
||||
>>> bank.save()
|
||||
>>> bank_account = BankAccount()
|
||||
>>> bank_account.bank = bank
|
||||
>>> bank_account.owners.append(Party(company.party.id))
|
||||
>>> bank_account.currency = company.currency
|
||||
>>> bank_account_number = bank_account.numbers.new()
|
||||
>>> bank_account_number.type = 'iban'
|
||||
>>> bank_account_number.number = 'BE55442968847144'
|
||||
>>> bank_account.save()
|
||||
|
||||
>>> supplier_bank_account = BankAccount()
|
||||
>>> supplier_bank_account.owners.append(Party(supplier.id))
|
||||
>>> supplier_bank_account.currency = company.currency
|
||||
>>> supplier_bank_account_number = supplier_bank_account.numbers.new()
|
||||
>>> supplier_bank_account_number.type = 'iban'
|
||||
>>> supplier_bank_account_number.number = 'DE79370400440123619900'
|
||||
>>> supplier_bank_account.save()
|
||||
|
||||
Create Statement Journal::
|
||||
|
||||
>>> account_journal, = AccountJournal.find([('code', '=', 'STA')], limit=1)
|
||||
>>> journal = StatementJournal(name="Bank",
|
||||
... journal=account_journal,
|
||||
... account=accounts['cash'],
|
||||
... bank_account=bank_account,
|
||||
... )
|
||||
>>> journal.save()
|
||||
|
||||
Import CAMT.053 file::
|
||||
|
||||
>>> statement_import = Wizard('account.statement.import')
|
||||
>>> with file_open(
|
||||
... 'account_statement_sepa/tests/camt.053.001.02.xml', mode='rb') as fp:
|
||||
... camt = fp.read()
|
||||
>>> statement_import.form.file_ = camt
|
||||
>>> statement_import.form.file_format = 'camt_053_001'
|
||||
>>> statement_import.execute('import_')
|
||||
|
||||
Check Statement::
|
||||
|
||||
>>> statement, = statement_import.actions[0]
|
||||
>>> statement.name
|
||||
'Example_2009-05-12T00:00:00'
|
||||
>>> statement.date
|
||||
datetime.date(2009, 5, 12)
|
||||
>>> statement.start_balance
|
||||
Decimal('2000.00')
|
||||
>>> statement.end_balance
|
||||
Decimal('1900.00')
|
||||
>>> statement.total_amount
|
||||
Decimal('-100.00')
|
||||
>>> statement.number_of_lines
|
||||
1
|
||||
>>> len(statement.origins)
|
||||
1
|
||||
>>> origin, = statement.origins
|
||||
>>> origin.number
|
||||
>>> origin.date
|
||||
datetime.date(2009, 4, 29)
|
||||
>>> origin.amount
|
||||
Decimal('-100.00')
|
||||
>>> assertEqual(origin.party, supplier)
|
||||
>>> origin.description
|
||||
>>> origin.information['camt_creditor_name']
|
||||
'Supplier'
|
||||
>>> origin.information['camt_creditor_iban']
|
||||
'DE79370400440123619900'
|
||||
>>> origin.information['camt_remittance_information']
|
||||
'INV 2150135'
|
||||
11
modules/account_statement_sepa/tests/test_module.py
Normal file
11
modules/account_statement_sepa/tests/test_module.py
Normal file
@@ -0,0 +1,11 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.tests.test_tryton import ModuleTestCase
|
||||
|
||||
|
||||
class AccountStatementSepaTestCase(ModuleTestCase):
|
||||
"Test Account Statement Sepa module"
|
||||
module = 'account_statement_sepa'
|
||||
|
||||
|
||||
del ModuleTestCase
|
||||
8
modules/account_statement_sepa/tests/test_scenario.py
Normal file
8
modules/account_statement_sepa/tests/test_scenario.py
Normal file
@@ -0,0 +1,8 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.tests.test_tryton import load_doc_tests
|
||||
|
||||
|
||||
def load_tests(*args, **kwargs):
|
||||
return load_doc_tests(__name__, __file__, *args, **kwargs)
|
||||
Reference in New Issue
Block a user