i want to filter some data in standart odoo calendar. I need to dont show events, that is private for users, who dont participate that event, i can do this by adding new filter in views, like:
<filter string="new filter" name="dont_show_others_private_events" domain="['|', ('privacy','=','public'), '&' ,('partner_ids.user_ids', 'in', [uid]), ('privacy', '=', 'private')]"/>
but problem is, that this filter is visible and any user can turn it off.
How can i do the same on server level, maybe in models.py file? or there is way to hide this filter but leave it active? i tried also white this filter in views:
<record id="action_calendar_event_type" model="ir.actions.act_window">
<field name="name">Meeting Types</field>
<field name="res_model">calendar.event.type</field>
<field name="view_id" ref="view_calendar_event_type_tree"/>
<field name="domain">['|', ('privacy','=','public'), '&' ,('partner_ids.user_ids', 'in', [uid]), ('privacy', '=', 'private')]</field>
</record>
but is doesnt work for me
if i understood your question correctly you want this "filter" to always be active and users cannot disable it ?
If that is the case then add a new Record Rule and not a filter. You can add the new entry in the xml under the Security folder.
And here is an example of the record rule:
<record id="private_events_filter" model="ir.rule">
<field name="name">Private events filter</field>
<field name="model_id" ref="calendar.event"/>
<field name="domain_force">['|', ('privacy','=','public'), '&' ,('partner_ids.user_ids', 'in', [uid]), ('privacy', '=', 'private')]</field>
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
</record>