title: How to get distinct value from table using ORM methods in odoo
body: <p>In Odoo, I have a model <strong>"Email Rules"</strong>, there is one column <strong>number_of_days</strong>.</p>
  
  <p>Now what I need to do is to find <strong>distinct number_of_days</strong> from that model without fire query, I mean I want to use ORM methods not query.</p>
  
  <p>How can I do this ?  I don't have much idea about this.</p>
  
  <p>Odoo search_read and search methods to get data from table.</p>
  
  <pre><code>def search_read(self, cr, uid, domain=None, fields=None, offset=0, limit=None, order=None, context=None):
          """
          Performs a ``search()`` followed by a ``read()``.
  
          :param cr: database cursor
          :param user: current user id
          :param domain: Search domain, see ``args`` parameter in ``search()``. Defaults to an empty domain that will match all records.
          :param fields: List of fields to read, see ``fields`` parameter in ``read()``. Defaults to all fields.
          :param offset: Number of records to skip, see ``offset`` parameter in ``search()``. Defaults to 0.
          :param limit: Maximum number of records to return, see ``limit`` parameter in ``search()``. Defaults to no limit.
          :param order: Columns to sort result, see ``order`` parameter in ``search()``. Defaults to no sort.
          :param context: context arguments.
          :return: List of dictionaries containing the asked fields.
          :rtype: List of dictionaries.
  
          """
  
  
  @api.returns('self')
      def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
          """ search(args[, offset=0][, limit=None][, order=None][, count=False])
  
          Searches for records based on the ``args``
          :ref:`search domain &lt;reference/orm/domains&gt;`.
  
          :param args: :ref:`A search domain &lt;reference/orm/domains&gt;`. Use an empty
                       list to match all records.
          :param int offset: number of results to ignore (default: none)
          :param int limit: maximum number of records to return (default: all)
          :param str order: sort string
          :param bool count: if True, only counts and returns the number of matching records (default: False)
          :returns: at most ``limit`` records matching the search criteria
  
          :raise AccessError: * if user tries to bypass access rules for read on the requested object.
          """
  </code></pre>
  
  <p>Now what do I need to do is to find out all the data first then make it unique by pythonic way which is quite repulsive.</p>
  
  <p>So it would be great if anyone knows the smart solution for this.</p>