Search for disctint values using the ORM
Bug #557326 reported by
Numérigraphe
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Confirmed
|
Wishlist
|
OpenERP's Framework R&D | ||
Bug Description
Answers for Question #106692 indicate that for the moment we can't do a "SELECT DISTINCT" using the ORM : see https:/
There are cases where this would be useful (like searching the order ids in order lines), so I propose we add a new parameter "distinct=False" to the read() method of th OSVs.
When set to True, it would return distinct tuples only.
It seems easy to add in osv using a SELECT DISTINCT statement.
It may be a bit more tricky in osv_memory, and it will run slower of course, and none sane will use it there I suppose, so we should just throw a "not implemented" exception I guess.
Lionel
Changed in openobject-server: | |
importance: | Undecided → Wishlist |
description: | updated |
description: | updated |
To post a comment you must log in.
On Wednesday 07 April 2010, you wrote:
> Public bug reported:
>
> Answers for Question #106692 indicate that for the moment we can't do a
> "SELECT DISTINCT" using the ORM. There are cases where this would be
> useful (like searching the order ids in order lines), so I propose we add
> a new parameter "distinct=False" to the search() method of th OSVs. When
> set to True, it would return distinct tuples only.
> It seems easy to add in osv using a SELECT DISTINCT statement.
> It may be a bit more tricky in osv_memory, and it will run slower of
> course, and none sane will use it there I suppose, so we should just throw
> a "not implemented" exception I guess. Lionel
>
Aren't the orm.search() and orm.read() results already distinct, by definition?
Those functions use the id column as a key, and thus never expected to return
duplicate results.
Or am I missing something?