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

Error when using custom 'GROUP BY' filter

By
Marco Cid
on 11/21/14, 6:55 PM 1,318 views

Hi,

Im triying to create custom group by filters for my module, but im getting the following error message:

Traceback (most recent call last):
  File "/opt/openerp/70/openerp_prod/server/openerp/netsvc.py", line 292, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/opt/openerp/70/openerp_prod/server/openerp/service/web_services.py", line 626, in dispatch
    res = fn(db, uid, *params)
  File "/opt/openerp/70/openerp_prod/server/openerp/osv/osv.py", line 190, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/opt/openerp/70/openerp_prod/server/openerp/osv/osv.py", line 132, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/openerp/70/openerp_prod/server/openerp/osv/osv.py", line 199, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/openerp/70/openerp_prod/server/openerp/osv/osv.py", line 187, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/opt/openerp/70/openerp_prod/server/openerp/osv/orm.py", line 2740, in read_group
    cr.execute(query, where_clause_params)
  File "/opt/openerp/70/openerp_prod/server/openerp/sql_db.py", line 161, in wrapper
    return f(self, *args, **kwargs)
  File "/opt/openerp/70/openerp_prod/server/openerp/sql_db.py", line 226, in execute
    res = self._obj.execute(query, params)
ProgrammingError: syntax error at or near "GROUP"
LINE 6:             GROUP BY "trabis_lead_tendency_report_base"."com...

 

Apparently the query is wrong:

"SELECT min(trabis_lead_tendency_report_base.id) AS id, count(trabis_lead_tendency_report_base.id) AS company_name_count, "trabis_lead_tendency_report_base"."company_name" as company_name
            FROM "trabis_lead_tendency_report_base"
            WHERE
            GROUP BY "trabis_lead_tendency_report_base"."company_name"
            ORDER BY company_name"

There is nothing after the 'WHERE'

 

This is my filter view:

      <record id="view_lead_tendency_rec_search" model="ir.ui.view">
            <field name="name">trabis.lead.tendency.report.base.search</field>
            <field name="model">trabis.lead.tendency.report.base</field>
            <field name="arch" type="xml">
                <search string="Busqueda registro iniciativas">
                    <field name="company_name"/>
                    <field name="month_name"/>
                    <field name="date_year"/>
                    <group expand="0" string="Group By...">
                        <filter string="company_name" domain="[]" context="{'group_by':'company_name'}"/>
                        <filter string="month_name" domain="[]" context="{'group_by':'month_name'}"/>
                        <filter string="date_year" domain="[]" context="{'group_by':'date_year'}"/>
                </group>
                </search>
            </field>
        </record>

Any help will be greatly appreciated

Thanks.

 

 

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

1 follower(s)

Stats

Asked: 11/21/14, 6:55 PM
Seen: 1318 times
Last updated: 3/16/15, 8:10 AM