add splitline
This commit is contained in:
parent
90fbfa3fde
commit
b9b500624e
13 changed files with 299 additions and 27 deletions
|
@ -1185,4 +1185,72 @@ class CbInvTestCase(CashbookTestCase, InvestmentTestCase):
|
|||
},
|
||||
])
|
||||
|
||||
@with_transaction()
|
||||
def test_assetbook_split_in_category(self):
|
||||
""" splitbooking incoming with asset
|
||||
"""
|
||||
pool = Pool()
|
||||
Book = pool.get('cashbook.book')
|
||||
BType = pool.get('cashbook.type')
|
||||
Asset = pool.get('investment.asset')
|
||||
ProdTempl = pool.get('product.template')
|
||||
Uom = pool.get('product.uom')
|
||||
|
||||
types = self.prep_type()
|
||||
BType.write(*[
|
||||
[types],
|
||||
{
|
||||
'feature': 'asset',
|
||||
}])
|
||||
category = self.prep_category(cattype='in')
|
||||
|
||||
company = self.prep_company()
|
||||
party = self.prep_party()
|
||||
asset = self.prep_asset_item(
|
||||
company=company,
|
||||
product = self.prep_asset_product(name='Product 1'))
|
||||
self.assertEqual(asset.symbol, 'usd/u')
|
||||
|
||||
book, = Book.create([{
|
||||
'start_date': date(2022, 4, 1),
|
||||
'name': 'Book 1',
|
||||
'btype': types.id,
|
||||
'company': company.id,
|
||||
'currency': company.currency.id,
|
||||
'number_sequ': self.prep_sequence().id,
|
||||
'asset': asset.id,
|
||||
'quantity_uom': asset.uom.id,
|
||||
'quantity_digits': 2,
|
||||
}])
|
||||
|
||||
Book.write(*[
|
||||
[book],
|
||||
{
|
||||
'lines': [('create', [{
|
||||
'bookingtype': 'spin',
|
||||
'splitlines': [('create', [{
|
||||
'amount': Decimal('5.0'),
|
||||
'splittype': 'cat',
|
||||
'description': 'from category',
|
||||
'category': category.id,
|
||||
'quantity': Decimal('1.5'),
|
||||
}, {
|
||||
'amount': Decimal('6.0'),
|
||||
'splittype': 'cat',
|
||||
'description': 'from cashbook',
|
||||
'category': category.id,
|
||||
'quantity': Decimal('2.5'),
|
||||
}])],
|
||||
}])],
|
||||
}])
|
||||
|
||||
self.assertEqual(book.rec_name, 'Book 1 | 11.00 usd | Open | 4.00 u')
|
||||
self.assertEqual(book.balance_all, Decimal('11.0'))
|
||||
self.assertEqual(len(book.lines), 1)
|
||||
|
||||
self.assertEqual(book.lines[0].amount, Decimal('11.0'))
|
||||
self.assertEqual(book.lines[0].quantity, Decimal('4.0'))
|
||||
self.assertEqual(book.lines[0].quantity_uom.symbol, 'u')
|
||||
self.assertEqual(book.lines[0].rec_name, '01/15/2023|Rev/Sp|11.00 usd|- [-]|4.00 u')
|
||||
|
||||
# end CbInvTestCase
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue