bank accont number: add field 'company_owned'
This commit is contained in:
parent
fce531c210
commit
5c2d5e2a1d
3 changed files with 147 additions and 0 deletions
|
@ -11,6 +11,7 @@ from datetime import date
|
|||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond.modules.edocument_uncefact.tests.test_edocument_uncefact import get_invoice
|
||||
from trytond.modules.company.tests import create_company, set_company
|
||||
from trytond.exceptions import UserError
|
||||
from unittest.mock import Mock
|
||||
from decimal import Decimal
|
||||
|
@ -20,6 +21,53 @@ class EdocTestCase(ModuleTestCase):
|
|||
'Test e-rechnung module'
|
||||
module = 'edocument_xrechnung'
|
||||
|
||||
@with_transaction()
|
||||
def test_xrechn_bank_account_owned(self):
|
||||
""" check field 'company_owned' on bank.account.number
|
||||
"""
|
||||
pool = Pool()
|
||||
BankAccount = pool.get('bank.account')
|
||||
AccountNumber = pool.get('bank.account.number')
|
||||
Bank = pool.get('bank')
|
||||
Party = pool.get('party.party')
|
||||
|
||||
company = create_company()
|
||||
with set_company(company):
|
||||
bank_party, = Party.create([{
|
||||
'name': 'Bank 123',
|
||||
'addresses': [('create', [{}])]}])
|
||||
customer_party, = Party.create([{
|
||||
'name': 'Someone',
|
||||
'addresses': [('create', [{}])]}])
|
||||
bank, = Bank.create([{'party': bank_party.id}])
|
||||
|
||||
acc_company, acc_other, = BankAccount.create([
|
||||
{
|
||||
'bank': bank.id,
|
||||
'owners': [('add', [company.party.id])],
|
||||
'numbers': [('create', [
|
||||
{'type': 'iban', 'number': 'DE02300209000106531065'}])]
|
||||
}, {
|
||||
'bank': bank.id,
|
||||
'owners': [('add', [customer_party.id])],
|
||||
'numbers': [('create', [
|
||||
{'type': 'iban', 'number': 'DE02200505501015871393'}])]
|
||||
}])
|
||||
self.assertEqual(len(acc_company.numbers), 1)
|
||||
self.assertEqual(acc_company.numbers[0].company_owned, True)
|
||||
self.assertEqual(len(acc_other.numbers), 1)
|
||||
self.assertEqual(acc_other.numbers[0].company_owned, False)
|
||||
|
||||
company_numbers = AccountNumber.search(
|
||||
[('company_owned', '=', True)])
|
||||
self.assertEqual(len(company_numbers), 1)
|
||||
self.assertEqual(company_numbers[0].id, acc_company.numbers[0].id)
|
||||
|
||||
other_numbers = AccountNumber.search(
|
||||
[('company_owned', '=', False)])
|
||||
self.assertEqual(len(other_numbers), 1)
|
||||
self.assertEqual(other_numbers[0].id, acc_other.numbers[0].id)
|
||||
|
||||
@with_transaction()
|
||||
def test_xrechn_check_validator(self):
|
||||
""" check validation of optional route-id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue