This question has been flagged
2 Replies
2648 Views

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
Discard

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).

Best Answer

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
Discard
Best Answer

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
Discard

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>