How to create a Search and Calendar Views in Odoo?

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:

search

Explanation

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 .

Implementation

1
. Search Box in Odoo9

odoosearch

2. Group by filters in Odoo9

odoogroupby.png

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 Views

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:

calendar

Note: Don’t forget to add calendar to  view_mode in an action views.

Explanation

  • 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.

Implementation

odoocalendar

If you’re interested in trying it out, please check our Github repository 😉 .

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s