콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
13608 화면

I need to create division field(many2one) and need to group them by their parent department wise. good example I got from hr_view.xml.they categorize by 'manager', 'coach', 'department', etc.. How to add this feature to my own many2one field.?

Please advice..

<record id="view_employee_filter" model="ir.ui.view">
    <field name="name">Employees</field>
    <field name="model">hr.employee</field>
    <field name="arch" type="xml">
        <search string="Employees">
            <field name="name" string="Employees"/>
            <field name="department_id" />
            <field name="category_ids" groups="base.group_hr_user"/>
            <group expand="0" string="Group By...">
                <filter string="Manager" icon="terp-personal" domain="[]" context="{'group_by':'parent_id'}"/>
                <filter string="Coach" icon="terp-personal" domain="[]" context="{'group_by':'coach_id'}"/>
                <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
                <filter string="Job" icon="terp-gtk-select-all" domain="[]" context="{'group_by':'job_id'}"/>
                <filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
            </group>
        </search>
     </field>
 </record>
아바타
취소
베스트 답변

Create many2one field: 'division_id': fields.many2one('model name', 'Division'),

Create search field with group_by: <record id="view_name_filter" model="ir.ui.view"> <field name="name">xxx</field> <field name="model">model name</field> <field name="arch" type="xml"> <search string="xxx"> <field name="name" string="xxx"/> <field name="department_id"/> <group expand="0" string="Group By..."> <filter string="Division" icon="terp-personal" domain="[]" context="{'group_by':'division_id'}"/> /group> </search> </field> </record>

아바타
취소

Where do you put this code? Is it in a View that inherits another view? Or in some other place? Does it need to inherit something or any other details?

관련 게시물 답글 화면 활동
2
3월 15
4178
1
9월 18
13288
0
3월 15
5573
2
12월 23
12815
3
7월 22
23188