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

Nested tree view

By
hamdi1992
on 7/4/16, 8:20 AM 360 views

I want to create a nested tree view with a grouping by fileds like the nested tree view in leave module(leave summary action), but I did not find it source code in odoo.

Can someone Help me ??



1
Asmita Chavan
On 7/8/16, 8:01 AM

If you want to create Nested view like Leaves Summary, by setting default group_by in Menu Action.

If you can refer to source code of Menu Action of Leaves Summary:

<record model="ir.actions.act_window" id="open_company_allocation">

<field name="name">Leaves Summary</field>

<field name="res_model">hr.holidays</field>

<field name="view_type">form</field>

<field name="view_mode">tree,form</field>

<field name="view_id" eval="view_holiday_simple"/>

<field name="context">{'search_default_group_type': 1}</field>

<field name="domain">[('holiday_type','=','employee'), ('state', '!=', 'refuse')]</field>

<field name="search_view_id" ref="view_hr_holidays_filter"/>

</record>

In this,  in context we have passed default group_by in context:

<field name="context">{'search_default_group_type': 1}</field>

to give default group_by condition in context we have to first define that group_by condition in search view of model.

you can observe that, In search_view_id reference of search_view is given, in that view definition, we have set group_by condition:

<filter name="group_type" string="Type" context="{'group_by':'holiday_status_id'}"/>

Likewise, you can do it for your module.

Hope, this helps..

0
hamdi1992
On 7/8/16, 10:23 AM

Can I make this tree editable ??

Yes, you can make this tree view editable.

But the thing is, it will work only after removing filters which got applied through context.

Asmita Chavan
on 8/11/16, 8:13 AM

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

1 follower(s)

Stats

Asked: 7/4/16, 8:20 AM
Seen: 360 times
Last updated: 7/8/16, 10:23 AM