Skip to Content
Menu
This question has been flagged
1 Reply
4739 Views

On the hr_employee module, under the employee directory, in the form view there is a organizational chart (that can be turned on and off from the settings). 

I have a model that inherits from hr.employee and my goal is to render the same chart in my new view. In the hr.employee views there is a div in the forms where should render the chart, but it's empty.

From the hr_employee view:

------------

<page name="public" string="Work Information">

                                <div id="o_work_employee_container"> <!-- These two div are used position org_chart -->

                                    <div id="o_work_employee_main">

                                        <group string="Location">

                                            <field name="address_id"

                                                context="{'show_address': 1}"

                                                options='{"always_reload": True, "highlight_first_line": True}'/>

                                        </group>

                                        <group name="managers" string="Responsibles">

                                            <field name="coach_id"/>

                                        </group>

                                        <group string="Schedule" groups="base.group_no_one">

                                            <field name="resource_calendar_id"/>

                                        </group>

                                    </div>

                                </div>

                            </page>

------------

I tried to use the same divs but nothing is rendered, how can I use the same chart?


The form view:

------------

<record id="employee_details_form" model="ir.ui.view">

        <field name="name">Detalles empleado</field>

        <field name="model">hr.employee</field>

        <!--<field name="inherit_id" ref="hr_employee.hr_employee_public_view_form"/>-->

        <field name="arch" type="xml">

            <form string="Employee Details Form">

                <header>

                    <button name="test_method" string="Test button" type="object" attrs="" class="oe_highlight" />

                    <button name="calculate_salary" string="Calcular salario" type="object" attrs="" class="oe_highlight" />

                    <button name="calculate_all_salaries" string="Calcular todos los salarios" type="object" attrs="" class="oe_highlight" />

                </header>

                <sheet>

                    <div class="oe_title">

                        <h1>

                            <field name="name" />

                        </h1>

                    </div>

                    <group>

                        <group>

                            <field name="company_id" />

                            <field name="commercial_plan_id" />

                            <field name="parent_id" />

                        </group>

                        <group>

                            <field name="child_all_count" />

                            <field name="phone" />

                            <field name="sex" />

                        </group>

                    </group>

                    <group>

                        <field name="salary_type" />

                        <field name="base_salary" />

                        <field name="last_payment" />

                    </group>

                    <group>

                        <div id="o_employee_right">

                            <h4 class="o_org_chart_title mb16 mt0">Organization Chart</h4>

                            <field name="child_ids" widget="hr_org_chart" />

                        </div>

                    </group>

                    <notebook>

                        <page string="Pólizas">

                            <field name="policy_ids" />

                        </page>

                        <page string="Pagos">

                            <field name="payment_ids" />

                        </page>

                        <page string="Subordinados directos">

                            <field name="child_ids" />

                        </page>

                        <page string="Notas extra">

                            <field name="observation" />

                        </page>

                    </notebook>

                </sheet>

            </form>

        </field>

    </record>

------------

In the browser:

https://imgur.com/19AfU6M

Avatar
Discard
Best Answer

Hello  Ian Riva B,

You have to add child_ids field in you form view

                <div id="o_employee_right">

                    <h4 class="o_org_chart_title mb16 mt0">Organization Chart</h4>

                    <field name="child_ids" widget="hr_org_chart"/>

                </div>

add above code at your page.

Thank You!


Regards,




Email:      odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

    

Avatar
Discard
Author

Hi, thanks for your answer, but the code above it's rendering a list, do you know why? I edited the original answer with the code of my view and a screenshot.

Related Posts Replies Views Activity
0
Jan 21
1806
3
Aug 20
3951
2
Mar 21
3108
5
Aug 24
44939
4
Feb 24
5726