Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to create own filter and apply it by default

By
Jeremy ravel
on 2/4/15, 5:25 AM 937 views

Hi,

I am trying to display in the project a view with parent/child. So my question is how can i create a filter using group by ? and how can put my filter by default for all users ?

Should I modify the code in xlm files. Or  can I use the graphic's view in  Setting/action/windows action/project ?
 

2

Ankit H Gandhi(AHG)

--Ankit H Gandhi(AHG)--
996
| 5 3 6
Rajkot, India
--Ankit H Gandhi(AHG)--

Learning Python..

Ankit H Gandhi(AHG)
On 2/4/15, 5:56 AM

Hello Jeremy ravel,

using this code you can create your filter and also create by default that filter for all user.

this code use for create the filter

<record id="student_master_search" model="ir.ui.view">
    <field name="name">student.master.search</field>
    <field name="model">student.master</field>
    <field name="arch" type="xml">
        <search string="Student">
            <!--<filter string="give any string name" name="filter_name" domain="[pass the condition]"/> -->
            <filter string="Male" name="male" domain="[('gender','=','Male')]"/>
            <separator/>
            <field name="fname"/>
            <group expand="0" string="Group By..">
                <filter string="Last Name" domain="[]" context="{'group_by':'lname'}"/>
            </group>
        </search>
    </field>
</record>

this code use for by default for all user.

<record model="ir.actions.act_window" id="student_master_action">
    <field name="name">School Management</field>
    <field name="res_model">student.master</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form</field>
    <!-- <field name="context">{'search_default_filter_name':1}</field> -->
    <field name="context">{'search_default_male':1}</field>
    <field name="help" type="html">
        <p class="oe_view_nocontent_create">Student Information</p>
    </field>
</record>

if you find this answer helpful, please give me a thumbs up vote    

Regards,

Ankit H Gandhi

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 2/4/15, 5:25 AM
Seen: 937 times
Last updated: 3/16/15, 8:10 AM