Adding menu items and views
Once we have models for our data structure needs, we want a user interface so that our users can interact with them. This recipe builds on the Library Book
model from the previous recipe and adds a menu item to display a user interface featuring list and form views.
Getting ready
The add-on module for implementing the library.book
model, which was provided in the previous recipe, is needed. The paths that will be used are relative to our add-on module location (for example, ~/odoo-dev/local-addons/my_library/
).
How to do it...
To add a view, we will add an XML file with its definition to the module. Since it is a new model, we must also add a menu option for the user to be able to access it.
Be aware that the sequence of the following steps is relevant, since some of them use references to IDs that are defined in the preceding steps:
- Create the XML file to add the data records describing the user interface,
views/library_book.xml
:...