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

A simple group-by addition question in Products list view

By
Gil Bennoon
on 3/11/14, 11:40 AM 1,489 views

Hi,
Apologies for the newbie question but I'm trying to add a 'group-by' option for the products list view.
Specifically - group-by seller (or supplier). Whenever I edit the searchview and add any of the seller related fields, I'm getting an error that the field is related and not database-persisted field. ("Fields in 'groupby' must be regular database-persisted fields (no function or related fields), or function fields with store=True").
This error came when I tried to add my group-by with the following line at the group-by area, right below the 'Type' default group-by (Copied the previous line and changed the "filter string" ad the "group_by" fields values):

<filter string="Seller" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'seller_ids'}"/>

My questions are:
1. How can I find which are the fields in a view (for example the product list view) can use for a group-by?
2. How can I group-by my products list by a supplier?

Thanks! Gil.

Thanks!

1

Sudhir Arya (SA)

--Sudhir Arya (SA)--
10150
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow

LinkedIn

Blog

Stackoverflow

Sudhir Arya (SA)
On 3/11/14, 12:46 PM

Hi Gil,

You cannot use one2many or many2many field in group by. You can only use these fields for simple search.

Ex:

<field name="seller_ids" string="Sellers"/>

Hope this will help you.

Thanks Sudhir, I was wondering. Is there a way to find which fields ARE available for "Group-by"? And also - does that mean I cannot see products per their suppliers anywhere else in the system? Thanks!

Gil Bennoon
on 3/11/14, 1:24 PM

You can search it by Supplier name for that field.

&lt;field name="seller_ids"/&gt;

Sudhir Arya (SA)
on 3/11/14, 4:03 PM

Thanks for the reply Sudhir, I am aware of the search function and was looking for a "Group by" function. We have about 30 suppliers and I was looking to show a list of all products grouped by each one of our suppliers. If I have to do a "search" I will have to do it 30 times and it will not be one list. Any idea how can I create a list of products (all of them in one list) divided by supplier?

Gil Bennoon
on 3/11/14, 4:16 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

2 follower(s)

Stats

Asked: 3/11/14, 11:40 AM
Seen: 1489 times
Last updated: 3/16/15, 8:10 AM