line: spalte 'empfänger', Feld 'reference' + tests
This commit is contained in:
parent
30b91cf518
commit
5fdbb0ce89
10 changed files with 510 additions and 42 deletions
|
@ -202,6 +202,7 @@ class ReconTestCase(ModuleTestCase):
|
|||
types = self.prep_type()
|
||||
company = self.prep_company()
|
||||
category = self.prep_category(cattype='in')
|
||||
party = self.prep_party()
|
||||
book, = Book.create([{
|
||||
'name': 'Book 1',
|
||||
'btype': types.id,
|
||||
|
@ -219,12 +220,14 @@ class ReconTestCase(ModuleTestCase):
|
|||
'category': category.id,
|
||||
'description': 'Line 1',
|
||||
'amount': Decimal('5.0'),
|
||||
'party': party.id,
|
||||
}, {
|
||||
'date': date(2022, 5, 5),
|
||||
'bookingtype': 'in',
|
||||
'category': category.id,
|
||||
'description': 'Line 2',
|
||||
'amount': Decimal('7.0'),
|
||||
'party': party.id,
|
||||
'amount': Decimal('7.0'),
|
||||
},])],
|
||||
}])
|
||||
self.assertEqual(book.name, 'Book 1')
|
||||
|
@ -344,6 +347,7 @@ class ReconTestCase(ModuleTestCase):
|
|||
types = self.prep_type()
|
||||
category = self.prep_category(cattype='in')
|
||||
company = self.prep_company()
|
||||
party = self.prep_party()
|
||||
book, = Book.create([{
|
||||
'name': 'Book 1',
|
||||
'btype': types.id,
|
||||
|
@ -355,12 +359,14 @@ class ReconTestCase(ModuleTestCase):
|
|||
'category': category.id,
|
||||
'bookingtype': 'in',
|
||||
'amount': Decimal('1.0'),
|
||||
'party': party.id,
|
||||
}, {
|
||||
'date': date(2022, 5, 5),
|
||||
'description': 'Text 2',
|
||||
'category': category.id,
|
||||
'bookingtype': 'in',
|
||||
'amount': Decimal('1.0'),
|
||||
'party': party.id,
|
||||
}])],
|
||||
'reconciliations': [('create', [{
|
||||
'date': date(2022, 5, 28),
|
||||
|
@ -371,14 +377,14 @@ class ReconTestCase(ModuleTestCase):
|
|||
self.assertEqual(book.name, 'Book 1')
|
||||
self.assertEqual(book.state, 'open')
|
||||
self.assertEqual(len(book.lines), 2)
|
||||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|1.00 usd|Text 1 [Cat1]')
|
||||
self.assertEqual(book.lines[1].rec_name, '05/05/2022|1.00 usd|Text 2 [Cat1]')
|
||||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
||||
self.assertEqual(book.lines[1].rec_name, '05/05/2022|Rev|1.00 usd|Text 2 [Cat1]')
|
||||
self.assertEqual(len(book.reconciliations), 1)
|
||||
self.assertEqual(book.reconciliations[0].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
||||
self.assertEqual(len(book.reconciliations[0].lines), 0)
|
||||
|
||||
self.assertRaisesRegex(UserError,
|
||||
"For reconciliation, the line '05/01/2022|1.00 usd|Text 1 [Cat1]' must be in the status 'Check' or 'Done'.",
|
||||
"For reconciliation, the line '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]' must be in the status 'Check' or 'Done'.",
|
||||
Lines.write,
|
||||
*[
|
||||
[book.lines[0]],
|
||||
|
@ -420,9 +426,9 @@ class ReconTestCase(ModuleTestCase):
|
|||
Reconciliation.wfcheck(list(book.reconciliations))
|
||||
self.assertEqual(book.reconciliations[0].state, 'check')
|
||||
self.assertEqual(len(book.reconciliations[0].lines), 1)
|
||||
self.assertEqual(book.reconciliations[0].lines[0].rec_name, '05/01/2022|1.00 usd|Text 1 [Cat1]')
|
||||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|1.00 usd|Text 1 [Cat1]')
|
||||
self.assertEqual(book.lines[1].rec_name, '06/01/2022|1.00 usd|Text 2 [Cat1]')
|
||||
self.assertEqual(book.reconciliations[0].lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
||||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
||||
self.assertEqual(book.lines[1].rec_name, '06/01/2022|Rev|1.00 usd|Text 2 [Cat1]')
|
||||
|
||||
# move 2nd line into date-range of checked-reconciliation, wf-check
|
||||
Lines.write(*[
|
||||
|
@ -481,6 +487,7 @@ class ReconTestCase(ModuleTestCase):
|
|||
types = self.prep_type()
|
||||
category = self.prep_category(cattype='in')
|
||||
company = self.prep_company()
|
||||
party = self.prep_party()
|
||||
book, = Book.create([{
|
||||
'name': 'Book 1',
|
||||
'btype': types.id,
|
||||
|
@ -492,12 +499,14 @@ class ReconTestCase(ModuleTestCase):
|
|||
'category': category.id,
|
||||
'bookingtype': 'in',
|
||||
'amount': Decimal('1.0'),
|
||||
'party': party.id,
|
||||
}, {
|
||||
'date': date(2022, 6, 5),
|
||||
'description': 'Text 2',
|
||||
'category': category.id,
|
||||
'bookingtype': 'in',
|
||||
'amount': Decimal('1.0'),
|
||||
'party': party.id,
|
||||
}])],
|
||||
'reconciliations': [('create', [{
|
||||
'date': date(2022, 5, 28),
|
||||
|
@ -508,13 +517,13 @@ class ReconTestCase(ModuleTestCase):
|
|||
self.assertEqual(book.name, 'Book 1')
|
||||
self.assertEqual(book.state, 'open')
|
||||
self.assertEqual(len(book.lines), 2)
|
||||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|1.00 usd|Text 1 [Cat1]')
|
||||
self.assertEqual(book.lines[1].rec_name, '06/05/2022|1.00 usd|Text 2 [Cat1]')
|
||||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
||||
self.assertEqual(book.lines[1].rec_name, '06/05/2022|Rev|1.00 usd|Text 2 [Cat1]')
|
||||
|
||||
Lines.wfcheck([book.lines[0]])
|
||||
Reconciliation.wfcheck([book.reconciliations[0]])
|
||||
self.assertEqual(len(book.reconciliations[0].lines), 1)
|
||||
self.assertEqual(book.reconciliations[0].lines[0].rec_name, '05/01/2022|1.00 usd|Text 1 [Cat1]')
|
||||
self.assertEqual(book.reconciliations[0].lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
||||
|
||||
Lines.write(*[
|
||||
[book.lines[1]],
|
||||
|
@ -539,6 +548,7 @@ class ReconTestCase(ModuleTestCase):
|
|||
types = self.prep_type()
|
||||
category = self.prep_category(cattype='in')
|
||||
company = self.prep_company()
|
||||
party = self.prep_party()
|
||||
book, = Book.create([{
|
||||
'name': 'Book 1',
|
||||
'btype': types.id,
|
||||
|
@ -550,6 +560,7 @@ class ReconTestCase(ModuleTestCase):
|
|||
'category': category.id,
|
||||
'bookingtype': 'in',
|
||||
'amount': Decimal('1.0'),
|
||||
'party': party.id,
|
||||
}])],
|
||||
'reconciliations': [('create', [{
|
||||
'date': date(2022, 5, 28),
|
||||
|
@ -599,6 +610,7 @@ class ReconTestCase(ModuleTestCase):
|
|||
types = self.prep_type()
|
||||
category = self.prep_category(cattype='in')
|
||||
company = self.prep_company()
|
||||
party = self.prep_party()
|
||||
book, = Book.create([{
|
||||
'name': 'Book 1',
|
||||
'btype': types.id,
|
||||
|
@ -610,12 +622,14 @@ class ReconTestCase(ModuleTestCase):
|
|||
'category': category.id,
|
||||
'bookingtype': 'in',
|
||||
'amount': Decimal('1.0'),
|
||||
'party': party.id,
|
||||
}, {
|
||||
'date': date(2022, 5, 5),
|
||||
'description': 'Text 2',
|
||||
'category': category.id,
|
||||
'bookingtype': 'in',
|
||||
'amount': Decimal('1.0'),
|
||||
'party': party.id,
|
||||
}])],
|
||||
'reconciliations': [('create', [{
|
||||
'date': date(2022, 5, 28),
|
||||
|
@ -626,8 +640,8 @@ class ReconTestCase(ModuleTestCase):
|
|||
self.assertEqual(book.name, 'Book 1')
|
||||
self.assertEqual(book.state, 'open')
|
||||
self.assertEqual(len(book.lines), 2)
|
||||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|1.00 usd|Text 1 [Cat1]')
|
||||
self.assertEqual(book.lines[1].rec_name, '05/05/2022|1.00 usd|Text 2 [Cat1]')
|
||||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
||||
self.assertEqual(book.lines[1].rec_name, '05/05/2022|Rev|1.00 usd|Text 2 [Cat1]')
|
||||
self.assertEqual(book.lines[0].reconciliation, None)
|
||||
self.assertEqual(book.lines[1].reconciliation, None)
|
||||
self.assertEqual(len(book.reconciliations), 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue