account in module 'cashbook_account' verschoben
This commit is contained in:
parent
149baef174
commit
7a07da852d
18 changed files with 41 additions and 220 deletions
|
@ -160,39 +160,4 @@ class CategoryTestCase(ModuleTestCase):
|
|||
}])],
|
||||
}])
|
||||
|
||||
@with_transaction()
|
||||
def test_category_create_with_account(self):
|
||||
""" create category + account
|
||||
"""
|
||||
pool = Pool()
|
||||
Account = pool.get('account.account')
|
||||
Category = pool.get('cashbook.category')
|
||||
|
||||
company = self.prep_company()
|
||||
|
||||
with Transaction().set_context({
|
||||
'company': company.id,
|
||||
}):
|
||||
account, = Account.create([{
|
||||
'name': 'Account No 1',
|
||||
'code': '0123',
|
||||
}])
|
||||
|
||||
cat1, = Category.create([{
|
||||
'name': 'Test 1',
|
||||
'description': 'Info',
|
||||
'account': account.id,
|
||||
}])
|
||||
self.assertEqual(cat1.name, 'Test 1')
|
||||
self.assertEqual(cat1.rec_name, 'Test 1 [0123]')
|
||||
self.assertEqual(cat1.description, 'Info')
|
||||
self.assertEqual(cat1.company.rec_name, 'm-ds')
|
||||
|
||||
self.assertEqual(Category.search_count([
|
||||
('account_code', '=', '0123'),
|
||||
]), 1)
|
||||
self.assertEqual(Category.search_count([
|
||||
('account_code', '=', '123'),
|
||||
]), 0)
|
||||
|
||||
# end CategoryTestCase
|
||||
|
|
|
@ -27,9 +27,8 @@ class ConfigTestCase(ModuleTestCase):
|
|||
company = create_company(name='m-ds')
|
||||
return company
|
||||
|
||||
@with_transaction()
|
||||
def test_config_create(self):
|
||||
""" create config
|
||||
def prep_config(self):
|
||||
""" store config
|
||||
"""
|
||||
Configuration = Pool().get('cashbook.configuration')
|
||||
|
||||
|
@ -42,7 +41,13 @@ class ConfigTestCase(ModuleTestCase):
|
|||
self.assertEqual(cfg2.checked, True)
|
||||
self.assertEqual(cfg2.done, False)
|
||||
self.assertEqual(cfg2.catnamelong, True)
|
||||
self.assertEqual(cfg2.cataccno, True)
|
||||
return cfg2
|
||||
|
||||
@with_transaction()
|
||||
def test_config_create(self):
|
||||
""" create config
|
||||
"""
|
||||
self.prep_config()
|
||||
|
||||
@with_transaction()
|
||||
def test_config_create_multi_user(self):
|
||||
|
|
|
@ -333,7 +333,6 @@ class LineTestCase(ModuleTestCase):
|
|||
Line = pool.get('cashbook.line')
|
||||
Configuration = pool.get('cashbook.configuration')
|
||||
Category = pool.get('cashbook.category')
|
||||
Account = pool.get('account.account')
|
||||
|
||||
types = self.prep_type()
|
||||
category = self.prep_category(cattype='in')
|
||||
|
@ -342,31 +341,20 @@ class LineTestCase(ModuleTestCase):
|
|||
with Transaction().set_context({
|
||||
'company': company.id,
|
||||
}):
|
||||
accounts = Account.create([{
|
||||
'name': 'Account No 1',
|
||||
'code': '0123',
|
||||
}, {
|
||||
'name': 'Account No 2',
|
||||
'code': '2345',
|
||||
}])
|
||||
self.assertEqual(accounts[0].rec_name, '0123 - Account No 1')
|
||||
self.assertEqual(accounts[1].rec_name, '2345 - Account No 2')
|
||||
|
||||
category2, = Category.create([{
|
||||
'company': company.id,
|
||||
'name': 'Level1',
|
||||
'account': accounts[0].id,
|
||||
'cattype': 'in',
|
||||
'childs': [('create', [{
|
||||
'company': company.id,
|
||||
'name': 'Level2',
|
||||
'account': accounts[1].id,
|
||||
'cattype': 'in',
|
||||
}])],
|
||||
}])
|
||||
self.assertEqual(category2.rec_name, 'Level1 [0123]')
|
||||
self.assertEqual(category2.rec_name, 'Level1')
|
||||
self.assertEqual(len(category2.childs), 1)
|
||||
self.assertEqual(category2.childs[0].rec_name, 'Level1/Level2 [2345]')
|
||||
self.assertEqual(category2.childs[0].rec_name, 'Level1/Level2')
|
||||
|
||||
cfg1 = Configuration()
|
||||
cfg1.save()
|
||||
|
@ -395,15 +383,7 @@ class LineTestCase(ModuleTestCase):
|
|||
self.assertEqual(len(book.lines), 2)
|
||||
|
||||
self.assertEqual(cfg1.catnamelong, True)
|
||||
self.assertEqual(cfg1.cataccno, True)
|
||||
|
||||
self.assertEqual(book.lines[0].category.rec_name, 'Level1 [0123]')
|
||||
self.assertEqual(book.lines[1].category.rec_name, 'Level1/Level2 [2345]')
|
||||
self.assertEqual(book.lines[0].category_view, 'Level1 [0123]')
|
||||
self.assertEqual(book.lines[1].category_view, 'Level1/Level2 [2345]')
|
||||
|
||||
cfg1.cataccno = False
|
||||
cfg1.save()
|
||||
self.assertEqual(book.lines[0].category.rec_name, 'Level1')
|
||||
self.assertEqual(book.lines[1].category.rec_name, 'Level1/Level2')
|
||||
self.assertEqual(book.lines[0].category_view, 'Level1')
|
||||
|
@ -416,13 +396,6 @@ class LineTestCase(ModuleTestCase):
|
|||
self.assertEqual(book.lines[0].category_view, 'Level1')
|
||||
self.assertEqual(book.lines[1].category_view, 'Level2')
|
||||
|
||||
cfg1.cataccno = True
|
||||
cfg1.save()
|
||||
self.assertEqual(book.lines[0].category.rec_name, 'Level1 [0123]')
|
||||
self.assertEqual(book.lines[1].category.rec_name, 'Level1/Level2 [2345]')
|
||||
self.assertEqual(book.lines[0].category_view, 'Level1 [0123]')
|
||||
self.assertEqual(book.lines[1].category_view, 'Level2 [2345]')
|
||||
|
||||
@with_transaction()
|
||||
def test_line_delete_with_book_in_open_state(self):
|
||||
""" create cashbook + line, book in state=open, delete a line
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue