first commit
This commit is contained in:
5
modules/account_statement_coda/tests/CODA.txt
Normal file
5
modules/account_statement_coda/tests/CODA.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
0000001081700005 Address BBRUBEBB0 0403200393 00000 2
|
||||
12001BE47435000000080 EUR0000000000000000010717DUNDER MIFFLIN 001
|
||||
2100010000REF BANK 0000000000100000200717001010000COMMUNICATION 19071700100 0
|
||||
8001BE47435000000080 EUR0000000000100000010817 0
|
||||
9 000003000000000000000000000000100000 2
|
||||
2
modules/account_statement_coda/tests/__init__.py
Normal file
2
modules/account_statement_coda/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.
@@ -0,0 +1,105 @@
|
||||
===============================
|
||||
Account Statement Coda 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
|
||||
>>> from trytond.tools import file_open
|
||||
|
||||
Activate modules::
|
||||
|
||||
>>> config = activate_modules(
|
||||
... 'account_statement_coda',
|
||||
... partial(create_company, currency='EUR'), create_chart)
|
||||
|
||||
Get company::
|
||||
|
||||
>>> company = get_company()
|
||||
|
||||
Get accounts::
|
||||
|
||||
>>> accounts = get_accounts()
|
||||
>>> cash = accounts['cash']
|
||||
|
||||
Create parties::
|
||||
|
||||
>>> Party = Model.get('party.party')
|
||||
>>> customer = Party(name="Customer")
|
||||
>>> customer.save()
|
||||
>>> bank_party = Party(name="Bank")
|
||||
>>> bank_party.save()
|
||||
|
||||
Create Bank Account::
|
||||
|
||||
>>> Bank = Model.get('bank')
|
||||
>>> BankAccount = Model.get('bank.account')
|
||||
|
||||
>>> 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 = 'BE47435000000080'
|
||||
>>> bank_account.save()
|
||||
|
||||
Create Statement Journal::
|
||||
|
||||
>>> AccountJournal = Model.get('account.journal')
|
||||
>>> StatementJournal = Model.get('account.statement.journal')
|
||||
|
||||
>>> account_journal, = AccountJournal.find([('code', '=', 'STA')], limit=1)
|
||||
>>> journal = StatementJournal(name="Bank",
|
||||
... journal=account_journal,
|
||||
... account=cash,
|
||||
... bank_account=bank_account,
|
||||
... )
|
||||
>>> journal.save()
|
||||
|
||||
Import CODA file::
|
||||
|
||||
>>> statement_import = Wizard('account.statement.import')
|
||||
>>> with file_open('account_statement_coda/tests/CODA.txt', mode='rb') as fp:
|
||||
... coda = fp.read()
|
||||
>>> statement_import.form.file_ = coda
|
||||
>>> statement_import.form.file_format = 'coda'
|
||||
>>> statement_import.execute('import_')
|
||||
|
||||
Check Statement::
|
||||
|
||||
>>> Statement = Model.get('account.statement')
|
||||
>>> statement, = Statement.find([])
|
||||
>>> statement.name
|
||||
'001'
|
||||
>>> statement.date
|
||||
datetime.date(2017, 8, 1)
|
||||
>>> statement.start_balance
|
||||
Decimal('0')
|
||||
>>> statement.end_balance
|
||||
Decimal('100')
|
||||
>>> statement.total_amount
|
||||
Decimal('100')
|
||||
>>> statement.number_of_lines
|
||||
1
|
||||
>>> len(statement.origins)
|
||||
1
|
||||
>>> origin, = statement.origins
|
||||
>>> origin.number
|
||||
'0001'
|
||||
>>> origin.date
|
||||
datetime.date(2017, 7, 19)
|
||||
>>> origin.amount
|
||||
Decimal('100')
|
||||
>>> origin.description
|
||||
'COMMUNICATION'
|
||||
>>> origin.information['coda_bank_reference']
|
||||
'REF BANK '
|
||||
12
modules/account_statement_coda/tests/test_module.py
Normal file
12
modules/account_statement_coda/tests/test_module.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# 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 AccountStatementCodaTestCase(ModuleTestCase):
|
||||
'Test Account Statement Coda module'
|
||||
module = 'account_statement_coda'
|
||||
|
||||
|
||||
del ModuleTestCase
|
||||
8
modules/account_statement_coda/tests/test_scenario.py
Normal file
8
modules/account_statement_coda/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