book, line, category, types: berechtigung für company-user + test,
book: währung neu, line: buchungstyp, betrag, credit, debit, währung, sortierung
This commit is contained in:
parent
1a85b8e80e
commit
d57d76ba3b
20 changed files with 620 additions and 115 deletions
|
@ -8,6 +8,7 @@ from trytond.pool import Pool
|
|||
from trytond.transaction import Transaction
|
||||
from trytond.exceptions import UserError
|
||||
from datetime import date
|
||||
from decimal import Decimal
|
||||
|
||||
|
||||
class BookTestCase(ModuleTestCase):
|
||||
|
@ -20,13 +21,14 @@ class BookTestCase(ModuleTestCase):
|
|||
"""
|
||||
pool = Pool()
|
||||
Book = pool.get('cashbook.book')
|
||||
Types = pool.get('cashbook.type')
|
||||
|
||||
types, = Types.search([('short', '=','CAS')])
|
||||
|
||||
types = self.prep_type()
|
||||
company = self.prep_company()
|
||||
book, = Book.create([{
|
||||
'name': 'Book 1',
|
||||
'btype': types.id,
|
||||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
}])
|
||||
self.assertEqual(book.name, 'Book 1')
|
||||
self.assertEqual(book.btype.rec_name, 'CAS - Cash')
|
||||
|
@ -39,18 +41,21 @@ class BookTestCase(ModuleTestCase):
|
|||
"""
|
||||
pool = Pool()
|
||||
Book = pool.get('cashbook.book')
|
||||
Types = pool.get('cashbook.type')
|
||||
|
||||
types, = Types.search([('short', '=', 'CAS')])
|
||||
types = self.prep_type()
|
||||
category = self.prep_category()
|
||||
|
||||
company = self.prep_company()
|
||||
book, = Book.create([{
|
||||
'name': 'Book 1',
|
||||
'btype': types.id,
|
||||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
'lines': [('create', [{
|
||||
'date': date(2022, 5, 1),
|
||||
'description': 'test 1',
|
||||
'category': category.id,
|
||||
'bookingtype': 'in',
|
||||
'amount': Decimal('1.0'),
|
||||
}])],
|
||||
}])
|
||||
self.assertEqual(book.name, 'Book 1')
|
||||
|
@ -67,18 +72,21 @@ class BookTestCase(ModuleTestCase):
|
|||
"""
|
||||
pool = Pool()
|
||||
Book = pool.get('cashbook.book')
|
||||
Types = pool.get('cashbook.type')
|
||||
|
||||
types, = Types.search([('short', '=', 'CAS')])
|
||||
types = self.prep_type()
|
||||
category = self.prep_category()
|
||||
|
||||
company = self.prep_company()
|
||||
book, = Book.create([{
|
||||
'name': 'Book 1',
|
||||
'btype': types.id,
|
||||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
'lines': [('create', [{
|
||||
'date': date(2022, 5, 1),
|
||||
'description': 'test 1',
|
||||
'category': category.id,
|
||||
'bookingtype': 'in',
|
||||
'amount': Decimal('1.0'),
|
||||
}])],
|
||||
}])
|
||||
self.assertEqual(book.name, 'Book 1')
|
||||
|
@ -97,18 +105,21 @@ class BookTestCase(ModuleTestCase):
|
|||
"""
|
||||
pool = Pool()
|
||||
Book = pool.get('cashbook.book')
|
||||
Types = pool.get('cashbook.type')
|
||||
|
||||
types, = Types.search([('short', '=', 'CAS')])
|
||||
types = self.prep_type()
|
||||
category = self.prep_category()
|
||||
|
||||
company = self.prep_company()
|
||||
book, = Book.create([{
|
||||
'name': 'Book 1',
|
||||
'btype': types.id,
|
||||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
'lines': [('create', [{
|
||||
'date': date(2022, 5, 1),
|
||||
'description': 'test 1',
|
||||
'category': category.id,
|
||||
'bookingtype': 'in',
|
||||
'amount': Decimal('1.0'),
|
||||
}])],
|
||||
}])
|
||||
self.assertEqual(book.name, 'Book 1')
|
||||
|
@ -125,13 +136,14 @@ class BookTestCase(ModuleTestCase):
|
|||
"""
|
||||
pool = Pool()
|
||||
Book = pool.get('cashbook.book')
|
||||
Types = pool.get('cashbook.type')
|
||||
|
||||
types, = Types.search([('short', '=', 'CAS')])
|
||||
|
||||
types = self.prep_type()
|
||||
company = self.prep_company()
|
||||
book, = Book.create([{
|
||||
'name': 'Book 1',
|
||||
'btype': types.id,
|
||||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
}])
|
||||
self.assertEqual(book.name, 'Book 1')
|
||||
self.assertEqual(book.state, 'open')
|
||||
|
@ -188,18 +200,22 @@ class BookTestCase(ModuleTestCase):
|
|||
ResUser = pool.get('res.user')
|
||||
ResGroup = pool.get('res.group')
|
||||
Book = pool.get('cashbook.book')
|
||||
Types = pool.get('cashbook.type')
|
||||
|
||||
types, = Types.search([('short', '=', 'CAS')])
|
||||
types = self.prep_type()
|
||||
company = self.prep_company()
|
||||
grp_cashbook, = ResGroup.search([('name', '=', 'Cashbook')])
|
||||
usr_lst = ResUser.create([{
|
||||
'login': 'frida',
|
||||
'name': 'Frida',
|
||||
'groups': [('add', [grp_cashbook.id])],
|
||||
'companies': [('add', [company.id])],
|
||||
'company': company.id,
|
||||
}, {
|
||||
'login': 'diego',
|
||||
'name': 'Diego',
|
||||
'groups': [('add', [grp_cashbook.id])],
|
||||
'companies': [('add', [company.id])],
|
||||
'company': company.id,
|
||||
}])
|
||||
self.assertEqual(len(usr_lst), 2)
|
||||
self.assertEqual(usr_lst[0].name, 'Frida')
|
||||
|
@ -209,6 +225,8 @@ class BookTestCase(ModuleTestCase):
|
|||
'name': 'Fridas book',
|
||||
'owner': usr_lst[0].id,
|
||||
'btype': types.id,
|
||||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
}])
|
||||
self.assertEqual(book.rec_name, 'Fridas book'),
|
||||
self.assertEqual(book.owner.rec_name, 'Frida'),
|
||||
|
@ -245,9 +263,9 @@ class BookTestCase(ModuleTestCase):
|
|||
ResUser = pool.get('res.user')
|
||||
ResGroup = pool.get('res.group')
|
||||
Book = pool.get('cashbook.book')
|
||||
Types = pool.get('cashbook.type')
|
||||
|
||||
types, = Types.search([('short', '=', 'CAS')])
|
||||
types = self.prep_type()
|
||||
company = self.prep_company()
|
||||
grp_cashbook, = ResGroup.search([('name', '=', 'Cashbook')])
|
||||
grp_reviewer, = ResGroup.create([{
|
||||
'name': 'Cashbook Reviewer',
|
||||
|
@ -257,10 +275,14 @@ class BookTestCase(ModuleTestCase):
|
|||
'login': 'frida',
|
||||
'name': 'Frida',
|
||||
'groups': [('add', [grp_cashbook.id])],
|
||||
'companies': [('add', [company.id])],
|
||||
'company': company.id,
|
||||
}, {
|
||||
'login': 'diego',
|
||||
'name': 'Diego',
|
||||
'groups': [('add', [grp_cashbook.id, grp_reviewer.id])],
|
||||
'companies': [('add', [company.id])],
|
||||
'company': company.id,
|
||||
}])
|
||||
self.assertEqual(len(usr_lst), 2)
|
||||
self.assertEqual(usr_lst[0].name, 'Frida')
|
||||
|
@ -272,6 +294,8 @@ class BookTestCase(ModuleTestCase):
|
|||
'name': 'Fridas book',
|
||||
'owner': usr_lst[0].id,
|
||||
'reviewer': grp_reviewer.id,
|
||||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
'btype': types.id,
|
||||
}])
|
||||
self.assertEqual(book.rec_name, 'Fridas book'),
|
||||
|
@ -301,9 +325,9 @@ class BookTestCase(ModuleTestCase):
|
|||
ResUser = pool.get('res.user')
|
||||
ResGroup = pool.get('res.group')
|
||||
Book = pool.get('cashbook.book')
|
||||
Types = pool.get('cashbook.type')
|
||||
|
||||
types, = Types.search([('short', '=', 'CAS')])
|
||||
types = self.prep_type()
|
||||
company = self.prep_company()
|
||||
grp_cashbook, = ResGroup.search([('name', '=', 'Cashbook')])
|
||||
grp_observer, = ResGroup.create([{
|
||||
'name': 'Cashbook Observer',
|
||||
|
@ -313,10 +337,14 @@ class BookTestCase(ModuleTestCase):
|
|||
'login': 'frida',
|
||||
'name': 'Frida',
|
||||
'groups': [('add', [grp_cashbook.id])],
|
||||
'companies': [('add', [company.id])],
|
||||
'company': company.id,
|
||||
}, {
|
||||
'login': 'diego',
|
||||
'name': 'Diego',
|
||||
'groups': [('add', [grp_cashbook.id, grp_observer.id])],
|
||||
'companies': [('add', [company.id])],
|
||||
'company': company.id,
|
||||
}])
|
||||
self.assertEqual(len(usr_lst), 2)
|
||||
self.assertEqual(usr_lst[0].name, 'Frida')
|
||||
|
@ -328,6 +356,8 @@ class BookTestCase(ModuleTestCase):
|
|||
'name': 'Fridas book',
|
||||
'owner': usr_lst[0].id,
|
||||
'observer': grp_observer.id,
|
||||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
'btype': types.id,
|
||||
}])
|
||||
self.assertEqual(book.rec_name, 'Fridas book'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue