auswertung: dashboard-window aktualisieren bei änderung der auswertung
This commit is contained in:
parent
c0432d609d
commit
f06eacbadc
3 changed files with 98 additions and 2 deletions
|
@ -531,6 +531,79 @@ class ReportTestCase(CashbookTestCase):
|
|||
'types': [('add', [x.id for x in Types.search([])])],
|
||||
}])
|
||||
|
||||
@with_transaction()
|
||||
def test_report_check_update_of_actionviews(self):
|
||||
""" create 3x cashbooks, add evaluation, check created
|
||||
form + actionview
|
||||
"""
|
||||
pool = Pool()
|
||||
Evaluation = pool.get('cashbook_report.evaluation')
|
||||
try :
|
||||
DashboardAction = pool.get('dashboard.action')
|
||||
except:
|
||||
print('\n--== Module "dashboard" not installed ==--')
|
||||
DashboardAction = None
|
||||
|
||||
books = self.prep_report_3books()
|
||||
|
||||
company = self.prep_company()
|
||||
with Transaction().set_context({
|
||||
'company': company.id,
|
||||
}):
|
||||
evaluation, = Evaluation.create([{
|
||||
'name': 'Evaluation 1',
|
||||
'cashbooks': [('add', [x.id for x in books])],
|
||||
}])
|
||||
|
||||
# add dashboard-action
|
||||
if DashboardAction is not None:
|
||||
dbaction, = DashboardAction.create([{
|
||||
'user': Transaction().user,
|
||||
'act_window': evaluation.dashb_actwin.id,
|
||||
}])
|
||||
self.assertEqual(dbaction.user.rec_name, 'Administrator')
|
||||
self.assertEqual(dbaction.act_window.name, 'Evaluation 1')
|
||||
|
||||
self.assertEqual(evaluation.dtype, 'cashbooks')
|
||||
self.assertEqual(evaluation.chart, 'pie')
|
||||
self.assertEqual(evaluation.legend, True)
|
||||
self.assertEqual(evaluation.maincolor, 'default')
|
||||
self.assertEqual(evaluation.bgcolor, '#ffffc0')
|
||||
self.assertEqual(evaluation.currency.code, 'EUR')
|
||||
|
||||
# check uiview
|
||||
self.assertEqual(evaluation.ui_view_chart.model, 'cashbook_report.eval_line')
|
||||
self.assertEqual(evaluation.ui_view_chart.module, 'cashbook_report')
|
||||
self.assertEqual(evaluation.ui_view_chart.priority, 10)
|
||||
self.assertEqual(evaluation.ui_view_chart.type, 'graph')
|
||||
# action-window for dashbord
|
||||
self.assertEqual(evaluation.dashb_actwin.name, 'Evaluation 1')
|
||||
self.assertEqual(evaluation.dashb_actwin.res_model,
|
||||
'cashbook_report.eval_line')
|
||||
self.assertEqual(evaluation.dashb_actwin.usage,
|
||||
'dashboard')
|
||||
self.assertEqual(evaluation.dashb_actwin.domain,
|
||||
'[["evaluation", "=", %d]]' % evaluation.id)
|
||||
# action-view
|
||||
self.assertEqual(evaluation.dashb_actview.sequence, 10)
|
||||
self.assertEqual(evaluation.dashb_actview.view.id,
|
||||
evaluation.ui_view_chart.id)
|
||||
self.assertEqual(evaluation.dashb_actview.act_window.id,
|
||||
evaluation.dashb_actwin.id)
|
||||
|
||||
# update evaluation, this wil re-create the view/act-window
|
||||
# and update the dashboard-view, without removing it
|
||||
old_win_id = evaluation.dashb_actwin.id
|
||||
Evaluation.write(*[
|
||||
[evaluation],
|
||||
{
|
||||
'name': 'Evaluation 1a',
|
||||
}])
|
||||
self.assertTrue(old_win_id != evaluation.dashb_actwin.id)
|
||||
|
||||
if DashboardAction is not None:
|
||||
self.assertEqual(DashboardAction.search_count([]), 1)
|
||||
|
||||
@with_transaction()
|
||||
def test_report_chart_pie_book_red(self):
|
||||
""" create 3x cashbooks, add bookings,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue