Search code examples
python-3.xodoo-11

How to set a filter as default filter in odoo


i'm using odoo 11 and i want to set a default filter which group by employee. i made a modification on the module but it doesn't shows the right result(i want to remove the administrator filter) .I don't know what's the problem .Any idea for help please ?

enter image description here.

<record id="action_bt_overtime_management" model="ir.actions.act_window">
            <field name="name">Overtime</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">bt.hr.overtime</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="context">{'search_default_employee_id':1}</field>
            <field name="search_view_id" ref="bt_overtime_management_search"/>
            <field name="help" type="html">
                <p class="oe_view_nocontent_create">
                    Create Overtime Request
                </p>
            </field>
        </record>

Solution

  • Try to give like this

    <record id="action_bt_overtime_management" model="ir.actions.act_window">
                    <field name="name">Overtime</field>
                    <field name="type">ir.actions.act_window</field>
                    <field name="res_model">bt.hr.overtime</field>
                    <field name="view_type">form</field>
                    <field name="view_mode">tree,form</field>
                    <field name="context">{'group_by':'employee_id'}</field>
                    <field name="search_view_id" ref="bt_overtime_management_search"/>
                    <field name="help" type="html">
                        <p class="oe_view_nocontent_create">
                            Create Overtime Request
                        </p>
                    </field>
                </record>