error when reordering of Customers based on Country

Bug #675976 reported by Julian Robbins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

Using trunk as of today ie Openerp-server rev 3014

I consistently get this error with a newly created clean database. I get same error with gtk client too.

To reproduce
1. Go to Sales, Address Book, Customers
2. Click on Column header 'Country'
Then you get the error.
Ordering on City doesn't order correctly, but doesn't give an error. I have reported this previously as bug https://bugs.launchpad.net/openobject-client-web/+bug/660710

Environment Information :
System : Linux-2.6.35-22-generic-x86_64-with-Ubuntu-10.10-maverick
OS Name : posix
Distributor ID: Ubuntu
Description: Ubuntu 10.10
Release: 10.10
Codename: maverick
Operating System Release : 2.6.35-22-generic
Operating System Version : #35-Ubuntu SMP Sat Oct 16 20:45:36 UTC 2010
Operating System Architecture : 64bit
Operating System Locale : en_GB.UTF8
Python Version : 2.6.6
OpenERP-Client Version : 6.0.0-rc1-1
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/home/openerp/production/openerp-server/bin/netsvc.py", line 489, in dispatch
    result = ExportService.getService(service_name).dispatch(method, auth, params)
  File "/home/openerp/production/openerp-server/bin/service/web_services.py", line 586, in dispatch
    res = fn(db, uid, *params)
  File "/home/openerp/production/openerp-server/bin/osv/osv.py", line 57, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/openerp/production/openerp-server/bin/osv/osv.py", line 140, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/openerp/production/openerp-server/bin/osv/osv.py", line 130, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/openerp/production/openerp-server/bin/osv/orm.py", line 1835, in search
    return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
  File "/home/openerp/production/openerp-server/bin/osv/orm.py", line 4048, in _search
    order_by = self._generate_order_by(order, query)
  File "/home/openerp/production/openerp-server/bin/osv/orm.py", line 4015, in _generate_order_by
    order_by_clause = self._generate_m2o_order_by(order_field, query)
  File "/home/openerp/production/openerp-server/bin/osv/orm.py", line 3976, in _generate_m2o_order_by
    assert order_field_column._classic_write or getattr(order_field_column, 'store', False), "Many2one function/related fields must be stored to be used as ordering fields"
AssertionError: Many2one function/related fields must be stored to be used as ordering fields

Tags: crm rc1 trunk
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Hello Julian,

This is because some dynamically computed fields cannot be used as sort criterions, and this bug is thus a duplicate of bug 629332, so I will mark it as so.
We don't know yet if this will stay as a limitation or if we will implement a workaround for this.

Thanks for the report

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.