I need to create and apply custom filter on button press. I have created button on view which leads to calendar, but also I need to pass and apply my custom search filter to that calendar view.
<record id="view_task_form2_meetings" model="ir.ui.view">
<field name="name">project.task.form</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_form2"/>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<xpath expr=".//button" position="before">
<button class="oe_inline oe_stat_button" type="action"
icon="fa-calendar"
name="project_task_meetings.task_meeting_event"
context="{'search_default_task_id': [1],
'search_default_task_id': 1}">
<field string="Meetings" name="task_meeting_count" widget="statinfo"/>
</button>
</xpath>
</field>
</record>
I expected context to do the trick but it doesn't. Then I was told that action in name should work. There it is:
<record id="task_meeting_event" model="ir.actions.act_window">
<field name="name">Meetings</field>
<field name="res_model">calendar.event</field>
<field name="view_mode">calendar,tree,form</field>
<field name="view_id" ref="calendar.view_calendar_event_calendar"/>
<field name="search_view_id" ref="calendar.view_calendar_event_search"/>
<field name="context">{"search_default_task_id":1}</field>
</record>
But still no success. May I have any help
Have you found any solution? Please reply.