book: Feld 'start_date' + test,
line: balance-berechnung mit abstimmung gekoppelt + test, abstimmung: start/enddatum automatisch
This commit is contained in:
parent
5729ed0a07
commit
91a34e216b
13 changed files with 446 additions and 20 deletions
|
@ -32,6 +32,7 @@ class ReconTestCase(ModuleTestCase):
|
|||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
'number_sequ': self.prep_sequence().id,
|
||||
'start_date': date(2022, 5, 1),
|
||||
}])
|
||||
|
||||
recon1, = Reconciliation.create([{
|
||||
|
@ -179,6 +180,7 @@ class ReconTestCase(ModuleTestCase):
|
|||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
'start_balance': Decimal('12.50'),
|
||||
'start_date': date(2022, 5, 1),
|
||||
'number_sequ': self.prep_sequence().id,
|
||||
'reconciliations': [('create', [{
|
||||
'date': date(2022, 5, 28),
|
||||
|
@ -211,6 +213,7 @@ class ReconTestCase(ModuleTestCase):
|
|||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
'start_balance': Decimal('12.50'),
|
||||
'start_date': date(2022, 5, 1),
|
||||
'number_sequ': self.prep_sequence().id,
|
||||
'reconciliations': [('create', [{
|
||||
'date': date(2022, 5, 28),
|
||||
|
@ -271,6 +274,7 @@ class ReconTestCase(ModuleTestCase):
|
|||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
'number_sequ': self.prep_sequence().id,
|
||||
'start_date': date(2022, 5, 1),
|
||||
'reconciliations': [('create', [{
|
||||
'date': date(2022, 5, 28),
|
||||
'date_from': date(2022, 5, 1),
|
||||
|
@ -293,6 +297,56 @@ class ReconTestCase(ModuleTestCase):
|
|||
Reconciliation.wfcheck,
|
||||
recons)
|
||||
|
||||
@with_transaction()
|
||||
def test_recon_autoset_date_to(self):
|
||||
""" create reconciliation, check: set date_to to last date of checked-line
|
||||
"""
|
||||
pool = Pool()
|
||||
Book = pool.get('cashbook.book')
|
||||
Line = pool.get('cashbook.line')
|
||||
Reconciliation = pool.get('cashbook.recon')
|
||||
|
||||
types = self.prep_type()
|
||||
company = self.prep_company()
|
||||
party = self.prep_party()
|
||||
category = self.prep_category(cattype='in')
|
||||
book, = Book.create([{
|
||||
'name': 'Book 1',
|
||||
'btype': types.id,
|
||||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
'number_sequ': self.prep_sequence().id,
|
||||
'start_date': date(2022, 5, 1),
|
||||
'lines': [('create', [{
|
||||
'date': date(2022, 5, 5),
|
||||
'amount': Decimal('10.0'),
|
||||
'bookingtype': 'in',
|
||||
'party': party.id,
|
||||
'category': category.id,
|
||||
}, {
|
||||
'date': date(2022, 5, 18),
|
||||
'amount': Decimal('5.0'),
|
||||
'bookingtype': 'in',
|
||||
'party': party.id,
|
||||
'category': category.id,
|
||||
}])],
|
||||
}])
|
||||
self.assertEqual(book.name, 'Book 1')
|
||||
self.assertEqual(book.state, 'open')
|
||||
Line.wfcheck(list(book.lines))
|
||||
|
||||
recon, = Reconciliation.create([{
|
||||
'cashbook': book.id,
|
||||
'date': date(2022, 5, 28),
|
||||
'date_from': date(2022, 5, 5),
|
||||
'date_to': date(2022, 5, 31),
|
||||
}])
|
||||
# dates are updates by .create()
|
||||
self.assertEqual(recon.rec_name, '05/01/2022 - 05/18/2022 | 0.00 usd - 0.00 usd [0]')
|
||||
|
||||
Reconciliation.wfcheck([recon])
|
||||
self.assertEqual(recon.rec_name, '05/01/2022 - 05/18/2022 | 0.00 usd - 15.00 usd [2]')
|
||||
|
||||
@with_transaction()
|
||||
def test_recon_autoset_date_from(self):
|
||||
""" create reconciliation, check: set date_from to end of predecessor
|
||||
|
@ -309,9 +363,10 @@ class ReconTestCase(ModuleTestCase):
|
|||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
'number_sequ': self.prep_sequence().id,
|
||||
'start_date': date(2022, 5, 1),
|
||||
'reconciliations': [('create', [{
|
||||
'date': date(2022, 5, 28),
|
||||
'date_from': date(2022, 5, 1),
|
||||
'date_from': date(2022, 5, 5),
|
||||
'date_to': date(2022, 5, 31),
|
||||
}])],
|
||||
}])
|
||||
|
@ -320,6 +375,10 @@ class ReconTestCase(ModuleTestCase):
|
|||
Reconciliation.wfcheck([book.reconciliations[0]])
|
||||
Reconciliation.wfdone([book.reconciliations[0]])
|
||||
|
||||
# date_from is corrected by .create() to start_date of book
|
||||
self.assertEqual(book.reconciliations[0].rec_name,
|
||||
'05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
||||
|
||||
r2, = Reconciliation.create([{
|
||||
'cashbook': book.id,
|
||||
'date_from': date(2022, 6, 10),
|
||||
|
@ -359,6 +418,7 @@ class ReconTestCase(ModuleTestCase):
|
|||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
'number_sequ': self.prep_sequence().id,
|
||||
'start_date': date(2022, 5, 1),
|
||||
'lines': [('create', [{
|
||||
'date': date(2022, 5, 1),
|
||||
'description': 'Text 1',
|
||||
|
@ -500,6 +560,7 @@ class ReconTestCase(ModuleTestCase):
|
|||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
'number_sequ': self.prep_sequence().id,
|
||||
'start_date': date(2022, 5, 1),
|
||||
'lines': [('create', [{
|
||||
'date': date(2022, 5, 1),
|
||||
'description': 'Text 1',
|
||||
|
@ -562,6 +623,7 @@ class ReconTestCase(ModuleTestCase):
|
|||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
'number_sequ': self.prep_sequence().id,
|
||||
'start_date': date(2022, 5, 1),
|
||||
'lines': [('create', [{
|
||||
'date': date(2022, 5, 1),
|
||||
'description': 'Text 1',
|
||||
|
@ -625,6 +687,7 @@ class ReconTestCase(ModuleTestCase):
|
|||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
'number_sequ': self.prep_sequence().id,
|
||||
'start_date': date(2022, 5, 1),
|
||||
'lines': [('create', [{
|
||||
'date': date(2022, 5, 1),
|
||||
'description': 'Text 1',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue