# Search, filter, and group records

> Odoo allows for the searching, filtering, and grouping of records in a view to display only the most relevant records.

Fonte: https://docs.kmee.com.br/en/odoo/18.0/modules/primeiros-passos/pesquisar-e-filtrar-registros/

Odoo allows for the searching, filtering, and grouping of records in a view to display only the most relevant records. The search bar is located at the top of the view: start typing to [search for values](https://docs.kmee.com.br/en/odoo/18.0/modules/primeiros-passos/pesquisar-e-filtrar-registros/#search-values), or click the ▾ **(dropdown)** icon to access the [Filter](https://docs.kmee.com.br/en/odoo/18.0/modules/primeiros-passos/pesquisar-e-filtrar-registros/#search-filters), [Group By](https://docs.kmee.com.br/en/odoo/18.0/modules/primeiros-passos/pesquisar-e-filtrar-registros/#search-group), and [Favorites](https://docs.kmee.com.br/en/odoo/18.0/modules/primeiros-passos/pesquisar-e-filtrar-registros/#search-favorites) drop-down menus.

[]()

## Search for values

Use the search field to look for specific values, and add them as a filter. Type the value to search for (like a salesperson's name or a product), and select the desired option from the drop-down menu to apply the search filter.

Example

Instead of adding a [custom filter](https://docs.kmee.com.br/en/odoo/18.0/modules/primeiros-passos/pesquisar-e-filtrar-registros/#search-custom-filters) to select records where *Mitchell Admin* is the salesperson on the *Sales Analysis* report (**Sales app -> Reporting -> Sales**), search for `Mitch`, and click the ▸ **(submenu)** icon next to **Search Salesperson for: Mitch**, and select **Mitchell Admin**.

![Searching for a specific value on the Sales Analysis report](https://docs.kmee.com.br/odoo/referencias-18.0/img/applications/essentials/search/search-values.png)

Note

Using the search field is equivalent to using the *contains* operator when adding a [custom filter](https://docs.kmee.com.br/en/odoo/18.0/modules/primeiros-passos/pesquisar-e-filtrar-registros/#search-custom-filters). If a partial value is entered, and the desired field is directly selected (without selecting the ▸ **(submenu)**, *all* records containing the typed characters for the selected field are included.

[]()

## Filters

Filters are used to select records that meet specific criteria. The default selection of records is specific to each view, but can be modified by selecting one (or several) [preconfigured filters](https://docs.kmee.com.br/en/odoo/18.0/modules/primeiros-passos/pesquisar-e-filtrar-registros/#search-preconfigured-filters), or by adding a [custom filter](https://docs.kmee.com.br/en/odoo/18.0/modules/primeiros-passos/pesquisar-e-filtrar-registros/#search-custom-filters).

[]()

### Preconfigured filters

Modify the default selection of records by clicking the ▾ **(dropdown)** from the search bar, and selecting one (or several) *preconfigured filters* from the **Filters** drop-down menu.

Example

On the *Sales Analysis* report (**Sales app -> Reporting -> Sales**), only records that are at the *sales order* stage, with an *order date* within the last 365 days, are selected by default.

To also include records at the *quotation* stage, select **Quotations** from the **Filters**.

Furthermore, to *only* include sales order and quotation records from a specific year, like 2024, for example, first remove the existing `Order Date: Last 365 Days` filter by clicking × **(cancel)**, then select the **Order Date -> 2024** filter.

![Using preconfigured filters on the Sales Analysis report](https://docs.kmee.com.br/odoo/referencias-18.0/img/applications/essentials/search/preconfigured-filters.png)

Note

The preconfigured **Filters** are grouped, and each group is separated by a horizontal line. Selecting preconfigured filters from the same group allows records to match *any* of the applied conditions. However, selecting filters from different groups requires records to match *all* of the applied conditions.

[]()

### Custom filters

If the [preconfigured filters](https://docs.kmee.com.br/en/odoo/18.0/modules/primeiros-passos/pesquisar-e-filtrar-registros/#search-preconfigured-filters) are not specific enough, add a custom filter. To do so, click the ▾ **(dropdown)** icon in the search bar, then select **Filters -> Add Custom Filter**.

The **Add Custom Filter** pop-up window displays the matching option, filter rule, and a toggle to **Include archived** records.

![The Add Custom Filter pop-up window.](https://docs.kmee.com.br/odoo/referencias-18.0/img/applications/essentials/search/custom-filter.png)

The default matching configuration is to **Match any of the following rules**, indicating that each filter rule is applied independently. To change the matching configuration to **Match all of the following rules**, at least two filter rules must be added to the custom filter.

- **Match all** ▾ **of the following rules**: **All** of the filter rules must be met. Think of this as an *AND* (`&`) operation.
- **Match any** ▾ **of the following rules**: **Any** of the filter rules can be met. Think of this as an *OR* (`|`) operation.

By default, a single filter rule is added to the custom filter. The following describes the structure of a filter rule:

1. The first inline field is the *field name* to filter by. Some fields have refined parameters that are nested within another field. These fields have a ▸ **(submenu)** icon beside them, which can be selected to reveal the nested fields.
2. The second inline field is the conditional *operator* used to compare the field name to the value. The available conditional operators are specific to the field's data type.
3. The third inline field is the variable *value* of the field name. The value input may appear as a drop-down menu, a text input, a number input, a date/time input, a boolean selector, or it may be blank, depending on the operator used and the field's data type.

Three inline buttons are also available to the right of the rule's filter criteria:

1. \+ **(plus)**: Adds a new rule below the existing rule.

2. fa-sitemap **(node)**: Adds a new group of rules below the existing rule, with the **any** and **all** matching options available to define how each rule within this branch is applied to the filter. If the matching option is set to the same as the parent group, the fields are moved to join the parent group.

   Example

   If the matching option is set to **Match all** ▾ **of the following rules**, and a new branch is added with its matching option changed from **any** ▾ **of** to **all** ▾ **of**, the newly-added branch disappears, and its group of rules are moved to the parent group.

3. ⌫ **(delete)**: Deletes the node. If a branch node is deleted, all children of that node are deleted, as well.

A new filter rule can be added to the custom filter by clicking the **New Rule** button.

Once the filter criteria are defined, click **Add** to add the custom filter to the view.

Example

To target all leads and opportunities from the **CRM** app that are in the *Won* stage, and have an expected revenue greater than $1,000, the following should be entered:

**Match all** ▾ **of the following rules:**

1. **Stage** **is in** **Won**

2. **Expected Revenue** **>** `1,000`

3. **any** ▾ **of:**

   - **Type** **=** **Lead**
   - **Type** **=** **Opportunity**

![Adding a custom filter to filter specific records in CRM.](https://docs.kmee.com.br/odoo/referencias-18.0/img/applications/essentials/search/custom-filter-example.png)

Tip

Activate [Developer mode (debug mode)](https://docs.kmee.com.br/en/odoo/18.0/modules/administracao/modo-de-desenvolvedor-modo-de-depuracao/#developer-mode) to reveal each field's technical name and data type, as well as the **# Code editor** text area below the filter rules, to view and edit the domain manually.

[]()

## Group records

The display of records in a view can be clustered together, according to one of the *preconfigured groups*. To do so, click the ▾ **(dropdown)** icon in the search bar, then select one of the **Group By** options from the drop-down menu.

Example

To group the records by salesperson on the *Sales Analysis* report (**Sales app -> Reporting -> Sales**), click the **Salesperson** option from the **Group By** drop-down menu. The view changes to group the records by salesperson, without filtering out any records.

![Grouping records on the Sales Analysis report](https://docs.kmee.com.br/odoo/referencias-18.0/img/applications/essentials/search/group.png)

It is possible to *customize groups* by using a field present on the model. To do so, click **Add Custom Group**, and select a field from the drop-down menu.

Note

Several groups can be used at the same time. The first group that is selected is the main cluster, the next one that is added further divides the main group's categories, and so on. Furthermore, filters and groups can be used together to refine the view even more.

[]()

## Comparison

Certain reporting dashboards include a **Comparison** section in the drop-down menus of their search bars. This includes the Overall Equipment Effectiveness report for the **Manufacturing** app and the Purchase report for the **Purchase** app, among others.

The options in the fa-adjust **Comparison** section are used to compare data from two different time periods. Pick between the two comparison options: **(Time Filter): Previous Period** and **(Time Filter): Previous Year**.

Important

- For some reports, the **Comparison** section **only** appears in the search bar drop-down

  menu if one (or more) time periods have been selected in the **Filters** column. This is because there is nothing to compare if no time period is specified.

Additionally, some reports only allow use of the **Comparison** feature when the fa-pie-chart **(Pie Chart)** graph type or the ▦ **(Pivot)** view, is selected. A **Comparison** option can be selected even if another view is enabled, but doing so does **not** change the way data is displayed on the report.

![The search bar for the production analysis report.](https://docs.kmee.com.br/odoo/referencias-18.0/img/applications/essentials/search/comparison-section.png)

To view data using one of the two comparisons, begin by selecting a time period in the **Filters** column of the search bar drop-down menu. Then, select either **(Time Filter): Previous Period** or **(Time Filter): Previous Year** in the **Comparison** section.

With one of the **Comparison** options enabled, the report compares the data for the selected period, with the data for the same unit of time (month, quarter, year), one period or year prior. The way the data is displayed depends on the selected view:

- The fa-bar-chart **(Bar Chart)** shows two bars, side-by-side, for each unit of time for the selected time period. The left bar represents the selected time period, while the right bar represents the previous time period.
- The fa-line-chart **(Line Chart)** is displayed with two lines, one representing the selected time period, and the other representing the previous time period.
- The fa-pie-chart **(Pie Chart)** appears as a large circle with a smaller circle inside. The larger circle represents the selected time period, while the smaller circle represents the previous time period.
- The ▦ **(Pivot)** is displayed with each column split into two smaller columns. The right column represents the selected time period, while the left column represents the previous time period.

Example

In the **Production Analysis** report of the **Manufacturing** app, data for the second quarter of 2024 is compared to data for the second quarter of 2023. **Q2** is selected in the **End Date** filter section of the search bar drop-down menu. In the **Comparison** section, **End Date: Previous Year** is selected.

The current year is 2024, so the larger circle shows data for the second quarter (Q2) of 2024. The smaller circle shows data for the second quarter (Q2) of 2023, which is the same time period, but one *year* prior.

If **End Date: Previous Period** is selected instead, the smaller circle shows data for the first quarter (Q1) of 2024, which is the same time period, but one *period* prior.

![The comparison view of the Production Analysis report.](https://docs.kmee.com.br/odoo/referencias-18.0/img/applications/essentials/search/comparison.png)

[]()

## Favorites

Favorites are a way to save a specific search for future use, or as the new default filter for the view.

To save the current view as a favorite, click the ▾ **(dropdown)** icon in the search bar, then select the **Save current search** drop-down menu to display the following options:

- **Filter name**: Name of the favorited search.
- **Default filter**: Sets the favorited search as the default filter for the view.
- **Shared**: Makes the favorited search available to all users. Otherwise, by default, the favorited search is only available to the user who created it.

Once the options are set, click **Save** to save the favorited search.

![Saving a favorite search on the Sales Analysis report.](https://docs.kmee.com.br/odoo/referencias-18.0/img/applications/essentials/search/favorites.png)

Favorited searches are accessed by clicking the ▾ **(dropdown)** icon in the search bar, and are shown under fa-star **Favorites**. Searches that are only visible to the current user, i.e., that are not shared, are shown first, while any shared favorites, whether created by the current user or another user, are shown in a second section.

To remove a favorited search, click the ⌫ **(delete)** icon next to the saved search.

Tip

To view *all* favorited searches, [activate developer mode](https://docs.kmee.com.br/en/odoo/18.0/modules/administracao/modo-de-desenvolvedor-modo-de-depuracao/#developer-mode), then navigate to **Settings app -> Technical -> User-defined Filters**. From here, all favorited searches can be viewed, edited, archived, or deleted.
