Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odpovědi
4180 Zobrazení

Hello,

We are passing "group_by_no_leaf" in context of action, can anyone help me to understand exact use of that?

For example, as given below :

<record id="action_project_task_user_tree" model="ir.actions.act_window">
<field name="name">Tasks Analysis</field>
<field name="res_model">report.project.task.user</field>
<field name="view_type">form</field>
<field name="view_mode">graph,pivot</field>
<field name="search_view_id" ref="view_task_project_user_search"/>
<field name="context">{'group_by_no_leaf':1,'group_by':[]}</field>
<field name="help">This report allows you to analyse the performance of your projects and users. You can analyse the quantities of tasks, the hours spent compared to the planned hours, the average number of days to open or close a task, etc.</field>
</record>


Avatar
Zrušit
Nejlepší odpověď

Hi,

"group_by_no_leaf" is an optional parameter for list views that hides the top row of buttons when given. (The row containing the 'Create', 'Import', etc. buttons).

Avatar
Zrušit
Nejlepší odpověď

Here's a practical example:

Suppose you have a list of tasks related to various projects and users. You want to create a pivot view that shows the total number of tasks grouped by projects and users. If you set group_by_no_leaf to 1, you will only see the projects and users as groups without displaying the individual tasks. This can be useful when you're interested in high-level summaries and don't need to see each task's details.


'context': {'group_by_no_leaf': 1, 'group_by': []}


  • 'group_by_no_leaf': 1 indicates that you want to group without displaying individual leaf records.
  • 'group_by': [] means that no specific grouping fields are defined, so it will use the default grouping fields (if any) defined in the view.

The exact behavior and effect of group_by_no_leaf will depend on the specific view type (e.g., list, pivot, graph) and the configuration of your view. It allows you to control whether detailed records are shown when grouping records in a view.

Avatar
Zrušit
Nejlepší odpověď

Hello Mital Vaghani,

I hope you are doing well.

You can try this code 
Please find code in comment. 

I hope this will help you.

Thanks & Regards,
Email:    odoo@aktivsoftware.com   

Skype: kalpeshmaheshwari

Avatar
Zrušit

Please find code here :-

<record id="action_project_task_user_tree" model="ir.actions.act_window">
<field name="name">Tasks Analysis</field>
<field name="res_model">report.project.task.user</field>
<field name="view_mode">graph,pivot</field>
<field name="search_view_id" ref="view_task_project_user_search"/>
<field name="context">{'group_by_no_leaf':1, 'group_by':[], 'graph_measure': '__count__'}</field>
<field name="help">This report allows you to analyse the performance of your projects and users. You can analyse the quantities of tasks, the hours spent compared to the planned hours, the average number of days to open or close a task, etc.</field>
</record>

Related Posts Odpovědi Zobrazení Aktivita
3
lis 23
17322
3
lis 24
24935
1
dub 23
6071
3
dub 23
9311
2
pro 22
6811