← Back to team overview

openerp-india team mailing list archive

[Bug 715749] Re: [trunk] [5.0] [6.0] keep ids order on read method with an _inherits object

 

Hi

We had the same problem. When we search a model with a specified order close, the read method ignore the sorted id list the sort it with the default.
Because of sometimes we need a sorted result from read function we modified the _read_flat function with the following:

order_by = context['orderby'] or self._parent_order or self._order

So if we would like to use a different sorting method instead of the
default just put it into the context and the red method will use that.
If not, the read function works with the same way like before.

Regards
jozsef

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/715749

Title:
  [trunk] [5.0] [6.0] keep ids order on read method with an _inherits
  object

Status in OpenERP Server:
  Confirmed

Bug description:
  On v.5 and v.6 trunk.

  When you give a list of ids on read function of an _inherits object
  (like product.product), the read function returns automatically a list
  of dictionnaries sorted by id (for product.product) even if you give a
  not sorted list of id.

  To see that, on a new db with demo data, create a XML-RPC script which
  search all products with 'pc' in their name. This search function
  returns you a list of ids sorted by id. Take this list of ids and
  sorted it again with the biggest id at first and the smallest at last.

  Give this new sorted list to the read function and see the result of
  this function : the list of result is sorted by id (with the smallest
  id at first).

  It's a bug because the read function doesn't keep the order of ids
  give to the function.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/715749/+subscriptions