Related fields don't honour the search ordering.

Bug #1065936 reported by Vivek poddar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Confirmed
Low
OpenERP's Framework R&D

Bug Description

Hi,

I caught this bug when I was using XML-RPC to sort my custom model's record on the basis of name. The 'name' field in my custom model is a related field to 'Product model'. When tried searching on my model with name as the order it gave me the same record ids as it gave without using the order parameter.

My field defintion:
'name': fields.related('product_id', 'name', type='char', string="Name", readonly=True, store=False)

My Test case:
1. proxy.execute('MY_DB', 1, 'a', 'MY_MODEL', 'search', [], 0, 5, 'name asc')
    result = [1, 2, 3, 4, 5]
2. proxy.execute('MY_DB', 1, 'a', 'MY_MODEL', 'search', [], 0, 5, 'name desc')
    result = [1, 2, 3, 4, 5]
3. proxy.execute('MY_DB', 1, 'a', 'MY_MODEL', 'search', [], 0, 5, 'name asc')
    result = [51, 45, 21, 4, 5] , works good as name is a character field here.

I am using V6.1.

Revision history for this message
Vivek poddar (vivekimsit) wrote :

Hi,

It seems this bug is effective only when the related field is not stored in DB. Otherwise it works as expected.
But I will assume it as a bug.

Thanks and Regards!

Revision history for this message
Kinner Vachhani (kinner-vachhani) wrote :

The patch uploaded by Camp2camp in below link will solve your problem.
https://bugs.launchpad.net/openobject-server/+bug/629332

Revision history for this message
Jignesh Rathod(OpenERP) (jir-openerp) wrote :

Hello Vivek ,

I agree with you , When searching record with the order it does not return
ids in correct order. Its good to implement , So I am confirming this issue.

Thanks for reporting.

Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Low
status: New → Confirmed
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.