Hello dear fellow. In this article, we will learn how to create a Search and Calendar views in Odoo?
Search view is declared quite similarly to a form view, except that the view type and root element change to search instead of form, they are used to filter other view’s content, generally lists or graphs views.
Let’s take an example :
We have a model named Marks which has a Many2one fields called ‘student_id’ ‘course_id’ and four float fields ‘exam1’ ‘exam2’ ‘extrat’ and ‘average’.
So Marks search view looks like this:
Here we have added ‘student_id’ as searchable field, and course_id as a group by filter,
- Context : Search a python dictionary, merged into the action’s domain to generate the search domain. The context passed to the data view for searching and filtering.
- Filter : Adding data to the search context .
1. Search Box in Odoo9
2. Group by filters in Odoo9
When opening your list view, you’ll notice the search field to the upper right. If you type something there, you get suggestions about what to search for and there is also a set of predefined filters to choose form.
Calendar view provides timeline – schedule view for the data, they display records as events in a daily, weekly, or monthly calendar. Their root element is “Calendar”.
Here is an example of Calendar views:
Note: Don’t forget to add calendar to view_mode in an action views.
- color : Name of a record field to use for color segmentation.
- date_start: nome of record’s field holding the start date for the event.
If you’re interested in trying it out, please check our Github repository 😉 .