Help

1

How to add a default 'group by' filter to tree view?

Avatar
samir Guesmi

hi all ,

i have a tree view , i want to show it by default with grouped by (grouped by employee_id)

if someone can help .

thanks

Avatar
Discard
9 Answers
19
Avatar
Grover Menacho
Best Answer

On your search view you have something like this:

<filter name="group_employee_id" string="Category" icon="terp-partner" context="{'group_by':'employee_id'}"/>

So, on your action you have to send this by context:

<field name="context">{'search_default_group_employee_id': 1}</field>
1 Comment
Avatar
Discard
Avatar
Leonardo Donelli
-

I tried with just {'group_by': 'employee_id'} in the action context and it works.

5
Best Answer

What if this treeview is inside a form? Not called from an action.

4 Comments
Avatar
Discard
Avatar
Andre de Kock
-

Good question. I would also like to know.

Avatar
Muhammad Awais
-

did you found the answer ?

Avatar
Roger Escola Belarte
-

Same question

Did anyone get solution of this question??

1
Avatar
srikanth
Best Answer
<tree string="" default_order="field_name">
<field name=""/>
<field name=""/>
</tree>
Avatar
Discard
1
Avatar
Axel Mendoza
Best Answer

I do this in v7 it require an extension of the widget one2many or many2many

Avatar
Discard
0
Avatar
Bulgantamir
Best Answer
<filter name="group_employee_id" string="Category" icon="terp-partner" context="{'group_by':'employee_id'}"/>

So, on your action you have to send this by context:

<field name="context">{'search_default_group_employee_id': 1}</field>
Avatar
Discard
0
Avatar
Badache Zoubir
Best Answer

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

<field name="name">.............</field>

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

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

<field name="context">{'group_by':'employee_id'}</field>

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

<field name="domain">[('active', '=', True)]</field>

</record>

Avatar
Discard
0
Best Answer

Nice solution

Avatar
Discard