In a form view of a project.project model, I display related calendar.event records through a one2many field as a kanban
I'd like to filter that kanban view, but it doesn't work as described below.
On the form, I added the following field:
<field name="event_ids" mode="kanban"/>
The kanban shows up nicely on the form. Actually, a kanban view has been applied by default: the one that has the lowest sequence id.
As the system selected a kanban view, I assumed a search view is also applied by default.
The search view with the lowest sequence id is the following:
<record model="ir.ui.view" id="view_calendar_event_mysearch">
<field name="name">calendar.event.mysearch</field>
<field name="model">calendar.event</field>
<field name="arch" type="xml">
<search string="My search view">
<field name="allday"/>
<filter string="Full day events" name="filter_on_fullday" domain="[('allday','=',True)]"/>
</search>
</field>
</record>
If the search view would have been called from an action, I could have indicated a default filter in the act_window, like:
<field name="context">{'search_default_filter_on_fullday': 1}</field>
which made me think I could define a context on the field, like:
<field name="event_ids" mode="kanban" context="{'search_default_filter_on_fullday': 1}"/>
I must be missing something in my reasoning, because it doesn't work.
Maybe, no search view is selected by default. Can someone confirm?
How can I force a search view? And once a search view is applied, would it use the default filter?
If there is a search view, how can I tell the search view to execute the filter?
Thank you for your help.
https://www.odoo.com/forum/help-1/question/how-to-search-po-by-product-name-search-on-one2many-fields-31030