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

How to filter and group with count(*) in OpenERP

By
Mc
on 2/17/15, 6:24 AM 867 views

Hi,

I'm trying to make in OpenERP something like SELECT item1, item2 COUNT(*) FROM table WHERE conditions GROUP BY item1, item2 HAVING COUNT(*) > 5

I have in my tree view:

<field name="domain">CONDITIONS</field>
<field name="context">{'group_by': ['item1', 'item2']}</field>

I figured out that I can use read_group() function to make filtering for COUNT(*) using context['active_ids'] when this view is generated, however it is very slowly and inefficient. Cause I have to iterate through items and look for repetitions by Python.

What are possible solutions in this situations? Better would be to make this whole SELECT by using cursor manualy through wizard, or is there anything like COUNT(*) filtering in OpenERP view syntax?

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: 2/17/15, 6:24 AM
Seen: 867 times
Last updated: 3/16/15, 8:10 AM