evaluation - currency filtert ungenutzte währungen + test
This commit is contained in:
parent
01470569e7
commit
3278fc7e52
4 changed files with 125 additions and 2 deletions
|
@ -21,10 +21,21 @@ class ReportTestCase(CashbookTestCase):
|
|||
"""
|
||||
pool = Pool()
|
||||
Book = pool.get('cashbook.book')
|
||||
ResUser = pool.get('res.user')
|
||||
|
||||
user_admin, = ResUser.search([])
|
||||
type_cash = self.prep_type()
|
||||
type_bank = self.prep_type(name='Bank', short='BK')
|
||||
company = self.prep_company()
|
||||
|
||||
ResUser.write(*[
|
||||
[user_admin],
|
||||
{
|
||||
'companies': [('add', [company.id])],
|
||||
'company': company.id,
|
||||
}])
|
||||
self.assertEqual(user_admin.company.id, company.id)
|
||||
|
||||
(usd, euro) = self.prep_2nd_currency(company)
|
||||
sequ_id = self.prep_sequence().id
|
||||
category = self.prep_category(cattype='in')
|
||||
|
@ -113,6 +124,52 @@ class ReportTestCase(CashbookTestCase):
|
|||
self.assertEqual(books[2].balance, Decimal('23.0'))
|
||||
return books
|
||||
|
||||
@with_transaction()
|
||||
def test_report_currency_hasbookings(self):
|
||||
""" check detectpn of bookings @ currency
|
||||
"""
|
||||
pool = Pool()
|
||||
Currency = pool.get('currency.currency')
|
||||
Lines = pool.get('cashbook.line')
|
||||
|
||||
books = self.prep_report_3books()
|
||||
|
||||
company = self.prep_company()
|
||||
with Transaction().set_context({
|
||||
'company': company.id,
|
||||
}):
|
||||
self.assertEqual(len(books[0].lines), 2)
|
||||
self.assertEqual(books[0].currency.code, 'usd')
|
||||
self.assertEqual(len(books[1].lines), 2)
|
||||
self.assertEqual(books[1].currency.code, 'usd')
|
||||
self.assertEqual(len(books[2].lines), 2)
|
||||
self.assertEqual(books[2].currency.code, 'EUR')
|
||||
|
||||
euro, = Currency.search([('code', '=', 'EUR')])
|
||||
self.assertEqual(euro.cashbook_hasbookings, True)
|
||||
self.assertEqual(Currency.search_count([
|
||||
('cashbook_hasbookings', '=', True)
|
||||
]), 2)
|
||||
|
||||
Lines.delete(books[2].lines)
|
||||
self.assertEqual(euro.cashbook_hasbookings, False)
|
||||
|
||||
self.assertEqual(Currency.search_count([
|
||||
('cashbook_hasbookings', '=', True)
|
||||
]), 1)
|
||||
|
||||
usd, = Currency.search([('code', '=', 'usd')])
|
||||
self.assertEqual(usd.cashbook_hasbookings, True)
|
||||
|
||||
Lines.delete(books[0].lines)
|
||||
self.assertEqual(usd.cashbook_hasbookings, True)
|
||||
Lines.delete(books[1].lines)
|
||||
self.assertEqual(usd.cashbook_hasbookings, False)
|
||||
|
||||
self.assertEqual(Currency.search_count([
|
||||
('cashbook_hasbookings', '=', True)
|
||||
]), 0)
|
||||
|
||||
@with_transaction()
|
||||
def test_report_dtype_update(self):
|
||||
""" check unlink of cashbooks/types/currenciews
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue