9362: Attempting to select an "Available item" for the Book Report gives an error

This commit is contained in:
SNoiraud 2016-07-15 12:07:43 +02:00
parent 28cc175fb5
commit 5e7b84bdde

View File

@ -101,6 +101,8 @@ def _initialize_options(options, dbstate, uistate):
if not hasattr(options, "menu"): if not hasattr(options, "menu"):
return return
dbase = dbstate.get_database() dbase = dbstate.get_database()
if dbase.get_total() == 0:
return
menu = options.menu menu = options.menu
for name in menu.get_all_option_names(): for name in menu.get_all_option_names():
@ -142,6 +144,8 @@ def _get_subject(options, dbase):
options: The ReportOptions class options: The ReportOptions class
dbase: the database for which it corresponds dbase: the database for which it corresponds
""" """
if dbase.get_total() == 0:
return
if not hasattr(options, "menu"): if not hasattr(options, "menu"):
return "" return ""
menu = options.menu menu = options.menu
@ -366,6 +370,9 @@ class BookSelector(ManagedWindow):
def __init__(self, dbstate, uistate): def __init__(self, dbstate, uistate):
self.db = dbstate.db self.db = dbstate.db
if self.db.get_total() == 0:
WarningDialog(_("Your database is empty."), parent=uistate.window)
return
self.dbstate = dbstate self.dbstate = dbstate
self.uistate = uistate self.uistate = uistate
self.title = _('Book') self.title = _('Book')