Create booking from standard-cashbook to asset-cashbook
This commit is contained in:
parent
9c40e8990a
commit
d7aaa5eacc
2 changed files with 46 additions and 21 deletions
|
@ -551,6 +551,8 @@ class PlannerTestCase(object):
|
|||
@with_transaction()
|
||||
def test_planner_cronjobs_booking_transfer_asset(self):
|
||||
""" create job, configure transfer-booking to asset-cashbook,
|
||||
same currencies between cashbooks,
|
||||
same units between asset and cashbook
|
||||
"""
|
||||
pool = Pool()
|
||||
Planner = pool.get('cashbook.planner')
|
||||
|
@ -561,6 +563,7 @@ class PlannerTestCase(object):
|
|||
company = self.prep_company()
|
||||
with Transaction().set_context({'company': company.id}):
|
||||
job = self.prep_create_job()
|
||||
# rate of asset = 12.5 usd
|
||||
asset_book = self.prep_planner_asset_book()
|
||||
self.assertEqual(
|
||||
asset_book.rec_name,
|
||||
|
@ -573,14 +576,14 @@ class PlannerTestCase(object):
|
|||
Planner.write(*[
|
||||
[job],
|
||||
{
|
||||
'name': 'Transfer to Book-2',
|
||||
'name': 'buy asset',
|
||||
'amount': Decimal('10.0'),
|
||||
'bookingtype': 'mvout',
|
||||
'category': category.id,
|
||||
'subject': 'booking 10 usd --> 10.5 usd',
|
||||
'subject': 'invest 10.00 usd to buy 0.80 units',
|
||||
'booktransf': asset_book.id,
|
||||
'wfcheck': True}])
|
||||
self.assertEqual(job.rec_name, 'Transfer to Book-2')
|
||||
self.assertEqual(job.rec_name, 'buy asset')
|
||||
self.assertEqual(job.cashbook.rec_name, 'Book 1 | 0.00 usd | Open')
|
||||
self.assertEqual(
|
||||
job.booktransf.rec_name,
|
||||
|
@ -600,17 +603,18 @@ class PlannerTestCase(object):
|
|||
self.assertEqual(len(cashbook.lines), 1)
|
||||
self.assertEqual(
|
||||
cashbook.lines[0].rec_name,
|
||||
"06/01/2022|to|-10.00 €|booking 10 usd --> 10.5 usd" +
|
||||
" [Depot | 10.50 usd | Open]")
|
||||
"06/01/2022|to|-10.00 usd|invest 10.00 usd to buy 0.80 " +
|
||||
"units [Depot | 10.00 usd | Open | 0.8000 u]")
|
||||
self.assertEqual(cashbook.lines[0].state, 'check')
|
||||
|
||||
asset_book, = Cashbook.browse([job.booktransf])
|
||||
self.assertEqual(asset_book.rec_name, 'Depot | 10.50 usd | Open')
|
||||
self.assertEqual(
|
||||
asset_book.rec_name, 'Depot | 10.00 usd | Open | 0.8000 u')
|
||||
self.assertEqual(len(asset_book.lines), 1)
|
||||
self.assertEqual(
|
||||
asset_book.lines[0].rec_name,
|
||||
"06/01/2022|from|10.50 usd|booking 10 € --> 10.5 usd" +
|
||||
" [Book 1 | -10.00 € | Open]")
|
||||
"06/01/2022|from|10.00 usd|invest 10.00 usd to " +
|
||||
"buy 0.80 units [Book 1 | -10.00 usd | Open]|0.8000 u")
|
||||
self.assertEqual(asset_book.lines[0].state, 'check')
|
||||
self.assertEqual(asset_book.lines[0].state, 'check')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue