Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
15547 Lượt xem

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 ? 

<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>

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

1. In your search view, please add Group By filter

<record id="bt_overtime_management_search" model="ir.ui.view">
<field name="name">br.hr.overtime.search</field>
<field name="model">bt.hr.overtime</field>
<field name="arch" type="xml">
<field name="employee_id"/>
<group expand="0" string="Group By">
<filter name="group_employee" string="Employee" context="{'group_by':'employee_id'}"/>
</group>
</field>
</record>

2. And Define your filter as a default filter in your search view

<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_group_employee': 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>


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You want to set as group by employee but in your code given to filter only employee with id 1?

If you want to group use { 'group_by': 'employee_id'}


<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>
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 12 22
5012
2
thg 12 22
14456
2
thg 6 22
6322
2
thg 6 22
4705
0
thg 5 22
3858