Skip to content

Instantly share code, notes, and snippets.

@sehrishnaz
Created May 9, 2022 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sehrishnaz/320b5fd071f68b2976af3941cb592193 to your computer and use it in GitHub Desktop.
Save sehrishnaz/320b5fd071f68b2976af3941cb592193 to your computer and use it in GitHub Desktop.
How to inherit task search view in Odoo
<!--Inherit task search view -->
<record id="inherit_task_search_view" model="ir.ui.view">
<field name="name">project.task.search.form</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_search_form"/>
<field name="arch" type="xml">
<!--Below example shows how to visible invisible fields in search view -->
<xpath expr="//search/field[@name='name']" position="attributes">
<attribute name="string">You can change string or label of a field</attribute>
</xpath>
<xpath expr="//search/field[@name='parent_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//search/field[@name='user_ids']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//search/field[@name='tag_ids']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<!--Below example shows how to add new or custom fields in search view -->
<xpath expr="//search/field[@name='name']" position="after">
<field name="field_1"/>
<field name="field_2"/>
</xpath>
<!--Below example shows how to hide extra filters in search view -->
<xpath expr="//filter[@name='my_tasks']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//filter[@name='unassigned']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//filter[@name='starred']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//filter[@name='late']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//filter[@name='rating_task']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//filter[@name='message_needaction']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//filter[@name='inactive']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<!-- Below example shows how to hide extra group by in search view-->
<xpath expr="//group/filter[@name='personal_stage']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//group/filter[@name='user']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//group/filter[@name='kanban_state']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//group/filter[@name='date_deadline']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
@sehrishnaz
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment