book: hierarchie + test

book: Feld 'start_balance' entfernt
This commit is contained in:
Frederik Jaeckel 2022-09-15 23:49:54 +02:00
parent e10616e847
commit a2e7f192f8
16 changed files with 319 additions and 168 deletions

View file

@ -574,6 +574,36 @@ class LineTestCase(ModuleTestCase):
self.assertEqual(book.lines[2].rec_name, '05/01/2022|Rev/Sp|1.00 usd|Text 3 [-]')
self.assertEqual(book.lines[2].state, 'edit')
@with_transaction()
def test_line_to_non_type_book(self):
""" create cashbook w/o type
"""
pool = Pool()
Book = pool.get('cashbook.book')
Line = pool.get('cashbook.line')
category = self.prep_category(cattype='in')
company = self.prep_company()
party = self.prep_party()
book, = Book.create([{
'name': 'Book 1',
'btype': None,
'company': company.id,
}])
self.assertEqual(book.name, 'Book 1')
self.assertEqual(book.state, 'open')
self.assertRaisesRegex(UserError,
'The value for field "Cashbook" in "Cashbook Line" is not valid according to its domain.',
Line.create,
[{
'cashbook': book.id,
'date': date(2022, 5, 1),
'category': category.id,
'bookingtype': 'in',
'amount': Decimal('0.0'),
}])
@with_transaction()
def test_line_create_check_deny_write(self):
""" create cashbook + line, 'close' book, write to line