SELECT DISTINCT using ModelStorage?

Hello Team,
I’ve wondering what is the best approach to achieve the select distinct of a field.
I can think on:

  1. Use the Model.search and then apply a python set function to list
  2. Use the transaction and with raw sql use select distinct from postgresql

Anyone knows an efficient option using the trytond api, with domain maybe?
thanks.

DISTINCT does not apply to ORM.
But you could define a ModelSQL with a table_query which is based on a DISTINCT query. This way it will be integrated with the ORM.
Otherwise, you have to run a SQL query, there is no issue to use them when it is needed.

Thanks for clarification!