How to Hide Filters in Odoo 14

Viewed 465

How can I hide a filter in Odoo, I know I can use a record rule but in my case I can't. This is not working.

Please Note: This is not the filter I want to hide.

<filter name="today" **invisible="1"** string="Today's Investigation" domain="[('date','&gt;=', datetime.datetime.combine(context_today(), datetime.time(0,0,0))), ('date','&lt;=', datetime.datetime.combine(context_today(), datetime.time(23,59,59)))]"/>
3 Answers

The record rule is the best solution as far as i know an example of record rule on filter is

            <field name="name">ir.filters.own.rule.delete</field>
            <field name="model_id" ref="model_ir_filters"/>
            <field name="domain_force">[('user_id', '=', user.id)]</field>
            <field name="groups" eval="[(4, ref('base.group_user'))]"/>
            <field name="perm_read" eval="False"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_create" eval="False"/>
        </record> 

I don't understand utility of hide a filter. But if you want remove it, you can inherit the xml search view with the filter and xpath + replace the filter:

<xpath expr="//filter[@name='today']" position="replace">
</xpath>

The most importante in this code is position="replace".

Related