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.

4

How can a user add a "Group by" in a list view?

By
Gilles Lehoux
on 3/13/13, 12:03 PM 2,978 views

How can a user add a new "Group by" in a list view? By user I mean someone who is not a programmer or admin. If the admin can do it then how?

For example, when viewing the list of products, how can a user add "Group by manufacturer". This is not currently an option under "Group by".

This is not a question about filters. There is a way to create an advanced filter and save it. I'm asking for the same functionality but for "Group by".

7

Ray Carnes

--Ray Carnes--
15717
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

Ray Carnes
On 3/13/13, 7:08 PM

Group By... options are created in the XML definition of the Search view.


First, collect some information you will need:

  • Make sure you are in Developer mode (1) and your user is in the group Technical Features (2)

  • Navigate the menu sequence

    Sales -> Customers

  • From the Debug View# menu, select Edit Search View

  • In the window that pops up, you can see the definition of the base view, including the <group> tag at the bottom containing Salesperson, Company and Country. (Technically you could edit this view, but the next time you upgraded the module, or upgraded the software, your edits would be overwritten)

  • Note the name of this view - res.partner.select - and the object is is defined for - res.partner - and close the window.


Now, you need to make your own view that inherits the view you found and adds to it.

  • Navigate the menu sequence

    Settings -> User Interface -> Views

  • Find any Search view, open it and click Duplicate from the More menu.

  • Name the view. Something like custom.res.partner.groupbystate for example.

  • The Object is res.partner and the Inherited View is res.partner.select

  • Your XML will look like this:

<?xml version="1.0"?>

<filter string="Country" position="after">

<filter string="State" context="{'group_by': 'state_id'}"/>

</filter>

  • Save your new view

  • Navigate the menu sequence

    Sales -> Customers

  • Click Advanced Search to see the new Group by option


For more information:

(1) https://accounts.openerp.com/forum/Help-1/question/83/

(2) https://accounts.openerp.com/forum/Help-1/question/1276

I wish I could give more up-votes. Terrific answer. Thank you.

Gilles Lehoux
on 2/6/14, 11:59 PM

Great answer, Ray. It's worth noting that if you want to group by a custom field **on a report** that does not exist in the report model, you will have to add it. See my gist where I add a field to the Group by... options for the Sales Analysis Report. https://gist.github.com/travs-w/f75719c0c33488da874333ac36ff4fe1

Htm-Mbs, Travis Waelbroeck
on 5/13/16, 3:44 PM
1

Cyril Gaspard (GEM)

--Cyril Gaspard (GEM)--
4136
| 5 6 8
Paris, France
--Cyril Gaspard (GEM)--

Forum contributor since 2008

Cyril Gaspard (GEM)
On 3/13/13, 6:14 PM

Hi,

on the search box on the top right add you word to filter (the name of one of field displayed as a column in the tree or of table), you will have a list which propose you to do a search or a filter, choose filter, filter is done in the view, now you just have to save your filter to add it in the list, just click on the top right of the search box, on the right of "x" ( x is the button to delete your search), in section "personnal filter, give the name of filter and save just for you or for all users).

Bye

"Filter" and "Group by" are different. This is a question about "Group by".

Gilles Lehoux
on 3/13/13, 6:39 PM

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

3 follower(s)

Stats

Asked: 3/13/13, 12:03 PM
Seen: 2978 times
Last updated: 5/13/16, 3:45 PM