Skip to content

Commit 5b7fe24

Browse files
committed
[IMP] spreadsheet: new global filter on checkbox/boolean fields
task-4885903 X-original-commit: 1c8ae73
1 parent 90c0e56 commit 5b7fe24

12 files changed

+111
-90
lines changed

content/applications/productivity/spreadsheet/global_filters.rst

Lines changed: 85 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ These filters are particularly useful for reports and dashboards as users can ea
1010
customize the view to answer complex business questions spanning multiple data sources.
1111

1212
.. tip::
13-
When a spreadsheet with global filters is added to a dashboard, the filters appear as dropdown
14-
menus at the top of the dashboard. In a spreadsheet, they appear in a pane to the right of the
15-
spreadsheet.
13+
On a dashboard, global filters that have been :ref:`created in the underlying spreadsheet
14+
<spreadsheet/global-filters/create>` are applied via the search bar at the top of the dashboard.
1615

1716
.. image:: global_filters/dashboard-global-filters.png
1817
:alt: Global filters at the top of a dashboard
1918

20-
Three types of global filters are available:
19+
Four types of global filters are available:
2120

2221
- :ref:`Date <spreadsheet/global-filters/create-date>`: filters data based on a specific time range,
2322
with the options :guilabel:`Month / Quarter`, :guilabel:`Relative Period`, or :guilabel:`From /
@@ -27,6 +26,8 @@ Three types of global filters are available:
2726
related model.
2827
- :ref:`Text <spreadsheet/global-filters/create-text>`: filters data based on a string of text or a
2928
range of predefined values, e.g., a product reference or barcode.
29+
- :ref:`Yes/No <spreadsheet/global-filters/create-checkbox>`: filters data based on whether or not a
30+
checkbox, or boolean, field is set, e.g., lead is active.
3031

3132
Unlike the standard :icon:`fa-filter` :guilabel:`(Add filters)` spreadsheet function, which lets you
3233
sort and temporarily hide data, global filters act on the underlying :ref:`data sources
@@ -65,8 +66,9 @@ filter should act on, or match with.
6566

6667
Field matching is further explained in the relevant sections on creating
6768
:ref:`Date <spreadsheet/global-filters/create-date>`,
68-
:ref:`Relation <spreadsheet/global-filters/create-relation>`, and
69-
:ref:`Text <spreadsheet/global-filters/create-text>` global filters.
69+
:ref:`Relation <spreadsheet/global-filters/create-relation>`,
70+
:ref:`Text <spreadsheet/global-filters/create-text>`, and
71+
:ref:`Yes/No <spreadsheet/global-filters/create-checkbox>` global filters.
7072

7173
.. _spreadsheet/global-filters/create:
7274

@@ -76,19 +78,28 @@ Create global filters
7678
Open the desired spreadsheet from the **Odoo Documents** app or via the **Odoo Dashboards** app if
7779
you are adding filters to a dashboard.
7880

79-
.. tip::
80-
To access the underlying spreadsheet of a dashboard, with the **Dashboards** app open,
81-
:ref:`activate developer mode <developer-mode>`, then click the :icon:`fa-pencil`
82-
:guilabel:`(Edit)` icon that appears when hovering over the dashboard name.
81+
To add a new filter, click :icon:`os-global-filters` :guilabel:`Filters` to open the
82+
:guilabel:`Filters` panel. Under :guilabel:`Create filter`, click :icon:`fa-calendar`
83+
:guilabel:`Date`, :icon:`fa-link` :guilabel:`Relation`, :icon:`fa-font` :guilabel:`Text`, or
84+
:icon:`fa-toggle-off` :guilabel:`Yes/No` as appropriate.
8385

84-
To add a new filter, click :icon:`os-global-filters` :guilabel:`Filters`, then, under :guilabel:`Add
85-
a new filter...` click :guilabel:`Date`, :guilabel:`Relation`, or :guilabel:`Text` as appropriate.
86-
The :guilabel:`Filter properties` pane opens.
86+
.. note::
87+
Depending on the data source(s) present in the spreadsheet, suggested :ref:`relation filters
88+
<spreadsheet/global-filters/create-relation>` may be shown. Clicking on a suggested filter opens
89+
the :guilabel:`Filter properties` panel with certain values preconfigured.
8790

8891
When saving a global filter, if any required information is missing or if any information provided
8992
in the :ref:`Field matching <spreadsheet/global-filters/field-matching>` section is not appropriate,
9093
an error is shown stating :guilabel:`Some required fields are not valid`.
9194

95+
.. tip::
96+
- To access the underlying spreadsheet of a dashboard, with the **Dashboards** app open,
97+
:ref:`activate developer mode <developer-mode>`, then click the :icon:`fa-pencil`
98+
:guilabel:`(Edit)` icon that appears when hovering over the dashboard name.
99+
- Click :icon:`fa-thumb-tack` :guilabel:`(pin)` at the top of the :guilabel:`Filters` panel to
100+
allow another panel, such as the :guilabel:`Filter properties` panel, to open beside it.
101+
102+
92103
.. _spreadsheet/global-filters/create-date:
93104

94105
Date
@@ -101,32 +112,15 @@ Date
101112
With the :guilabel:`Filter properties` pane open:
102113

103114
#. Enter a name for the new date filter in the :guilabel:`Label` field.
104-
#. From the :guilabel:`Time range` dropdown menu, select one of the following:
105-
106-
- :guilabel:`Month / Quarter`: enables a dropdown menu of specific months and/or quarters and a
107-
year selector for the year. The values :guilabel:`Months` and :guilabel:`Quarters` are enabled
108-
by default. Disabling both of these values allows filtering by year only.
109-
110-
To set a :guilabel:`Default value`, enable
111-
:guilabel:`Automatically filter on the current period` and choose whether to filter on the
112-
current :guilabel:`Month`, :guilabel:`Quarter` or :guilabel:`Year`.
113-
114-
- :guilabel:`Relative Period`: enables a dropdown menu of specific time ranges relative to the
115-
current date (e.g., :guilabel:`Year to Date`, :guilabel:`Last 7 Days`,
116-
:guilabel:`Last 30 Days`, etc.).
117-
118-
To set a :guilabel:`Default value`, select one of the available values.
119-
120-
- :guilabel:`From / To`: enables :guilabel:`Date from...` and :guilabel:`Date to...` date
121-
selection fields to define a specific time range (e.g., `06/05/2024` to `06/27/2024`).
122-
115+
#. To set a :guilabel:`Default value`, select one of the available values, e.g, `Last 30 Days` or
116+
`Month to Date`. When applying the global filter, any of the available values can be selected.
123117
#. In the :guilabel:`Field matching` section, for each data source, click beside :guilabel:`Date
124118
field` and select the field the filter should match with.
125119

126120
The :guilabel:`Period offset` option, which appears when a date field is chosen, enables
127121
comparisons to be made by shifting the time range by one or more periods in the past or future.
128122
By default, no period offset is defined. To define a period offset, select :guilabel:`Previous`
129-
or :guilabel:`Next`, then select the desired number of periods in the past of future.
123+
or :guilabel:`Next`, then select the desired number of periods in the past or future.
130124

131125
.. tip::
132126

@@ -142,20 +136,19 @@ With the :guilabel:`Filter properties` pane open:
142136
#. Click :guilabel:`Save`.
143137

144138
.. example::
145-
In the example below, a :guilabel:`Date` global filter has been created to allow the pivot table
146-
and chart to show sales data per quarter. If only a year is selected, data is shown for the
147-
entire year.
139+
In the example below, a :guilabel:`Date` global filter allows the pivot table and chart to show
140+
sales data for any defined time period, in this case, `July 2025`. The :guilabel:`Custom Range`
141+
always shows the actual dates corresponding to the chosen period; it can also be updated
142+
directly.
148143

149144
.. image:: global_filters/example-date.png
150-
:alt: A date filter to filter on quarter and year
145+
:alt: A date filter filters data for July 2025
151146

152147
In the :guilabel:`Field matching` section of the :guilabel:`Filter properties`, the field
153-
:guilabel:`Order Date` has been selected as the matching date field. A matching date field is not
154-
needed for *List #1* as we will not use this filter on the data source in question.
148+
:guilabel:`Order Date` has been selected as the matching date field.
155149

156150
.. image:: global_filters/field-matching-date.png
157151
:alt: A date filter with the Order Date selected as the matching field
158-
:scale: 80%
159152

160153
.. _spreadsheet/global-filters/create-relation:
161154

@@ -191,66 +184,92 @@ With the :guilabel:`Filter properties` pane open:
191184
#. Click :guilabel:`Save`.
192185

193186
.. example::
194-
In the example below, a :guilabel:`Relation` filter has been created to allow the pivot table
195-
and chart to show sales data related to selected salespeople only. The *User* model was set as
196-
the :guilabel:`Related model`.
187+
In the example below, a :guilabel:`Relation` filter allows the pivot table and chart to show
188+
sales data related to selected salespeople only. The *User* model is set as the
189+
:guilabel:`Related model`.
197190

198191
.. image:: global_filters/example-relation.png
199192
:alt: Relation filter set on a pivot table
200193

201194
In the :guilabel:`Field matching` section of the :guilabel:`Filter properties`, the field
202195
:guilabel:`Salesperson` was automatically assigned as the matching field for both the pivot table
203-
and the chart. A matching field is not needed for *List #1* as we will not use this filter on the
204-
data source in question.
196+
and the chart.
205197

206198
.. image:: global_filters/field-matching-relation.png
207199
:alt: A relation filter with the User model configured
208-
:scale: 80%
209200

210201
.. _spreadsheet/global-filters/create-text:
211202

212203
Text
213204
----
214205

215206
.. note::
216-
A :guilabel:`Text` filter can only match with a :ref:`Text (char)
217-
<studio/fields/simple-fields-text>`, :ref:`Integer <studio/fields/simple-fields-integer>` or
218-
:ref:`Decimal (float) <studio/fields/simple-fields-decimal>` field.
207+
A :guilabel:`Text` filter can only match with a :ref:`Text
208+
<studio/fields/simple-fields-text>` (char), :ref:`Integer <studio/fields/simple-fields-integer>`,
209+
or :ref:`Decimal <studio/fields/simple-fields-decimal>` (float) field.
219210

220211
With the :guilabel:`Filter properties` pane open:
221212

222213
#. Enter a name for the new text filter in the :guilabel:`Label` field.
223214
#. Optionally, enable :guilabel:`Restrict values to a range`. Doing so allows you to input a
224-
spreadsheet range either by typing the range or selecting it from within the spreadsheet.
215+
spreadsheet range either by typing the range or selecting it from the relevant sheet. The
216+
referenced range must be in the same spreadsheet.
225217
#. Optionally, enter a :guilabel:`Default value`.
226218
#. In the :guilabel:`Field matching` section, for each data source click below the data source name
227219
and select the field the :guilabel:`Text` filter should match with.
228220

229221
#. Click :guilabel:`Save`.
230222

231223
.. example::
232-
In the example below, a :guilabel:`Text` global filter was created to allow the user to select a
233-
product from the :guilabel:`Product` filter and have both the pivot table and chart only show
234-
sales data related to that specific product.
224+
In the example below, a :guilabel:`Text` global filter allows the pivot table and chart to show
225+
sales data only for products whose internal reference matches or contains the entered value, in
226+
this case, `FURN`. Multiple values can be entered if desired.
235227

236228
.. image:: global_filters/example-text.png
237229
:alt: Global filters set on a pivot table
238230

239-
In the :guilabel:`Filter properties`, the :guilabel:`Possible values` of the filter were
240-
restricted to the range :guilabel:`'Products (List #1)'!A2:A34`. This corresponds to the range
241-
containing the :guilabel:`Display name` of the product on a list inserted in the spreadsheet.
231+
In the :guilabel:`Field matching` section of the :guilabel:`Filter properties`, the
232+
:guilabel:`Internal Reference` of the :guilabel:`Product Variant` was selected as the matching
233+
field for both the pivot table and the chart.
242234

243235
.. image:: global_filters/field-matching-text.png
244-
:alt: A text filter with a restricted range
245-
:scale: 80%
236+
:alt: A text filter matched to the product's internal reference
237+
238+
.. tip::
239+
If you selected :guilabel:`Restrict values to range` when configuring the text filter and
240+
defined a range, you select the value of the text field from a dropdown.
246241

247-
With this configuration, the pivot table and chart can be filtered by product name by
248-
selecting one of the predefined values available in the text filter. In this case,
249-
:guilabel:`Furniture` has already been selected as the :guilabel:`Product category`, meaning
250-
that only products of this category can be selected as possible values.
242+
.. _spreadsheet/global-filters/create-checkbox:
243+
244+
Yes/No
245+
------
246+
247+
.. note::
248+
A :guilabel:`Yes/No` filter can only match with a :ref:`Checkbox
249+
<studio/fields/simple-fields-checkbox>` (boolean) field.
250+
251+
With the :guilabel:`Filter properties` pane open:
252+
253+
#. Enter a name for the new :guilabel:`Yes/No` filter in the :guilabel:`Label` field.
254+
#. Optionally, select :guilabel:`Is set` or :guilabel:`Is not set` as the :guilabel:`Default value`.
255+
#. In the :guilabel:`Field matching` section, for each data source, click below the data source name
256+
and select the field the :guilabel:`Yes/No` filter should match with.
257+
#. Click :guilabel:`Save`.
258+
259+
.. example::
260+
In the example below, a :guilabel:`Yes/No` global filter was created to allow the user to see
261+
all opportunities that are active, i.e., for which the :guilabel:`Active` checkbox is enabled
262+
on the record, or all opportunities that are inactive, i.e., for which the :guilabel:`Active`
263+
checkbox is disabled. Leaving the filter empty shows both active and inactive opportunities.
264+
265+
.. image:: global_filters/example-boolean.png
266+
:alt: Global filters set on a pivot table
267+
268+
In the :guilabel:`Field matching` section of the :guilabel:`Filter properties`, the field
269+
:guilabel:`Active` was assigned as the matching field for the pivot table.
251270

252-
Furthermore, if the values in the range have been retrieved dynamically from the database, as in
253-
this case, the text filter is also dynamic, i.e., will reflect changes made to those values.
271+
.. image:: global_filters/field-matching-checkbox.png
272+
:alt: A yes/no filter with the Active field set as matching field
254273

255274
Manage and use global filters
256275
=============================
@@ -265,8 +284,8 @@ It is possible to:
265284
.. tip::
266285
Reloading the browser will cause any global filters to reset to their initial state or default
267286
value, as relevant. To refresh data in an inserted list, pivot table, or chart without losing
268-
global filters that have been applied, click :menuselection:`Data --> Refresh all data` from
269-
the menu bar.
287+
global filters that have been applied, click :menuselection:`Data -->` :icon:`os-refresh-data`
288+
:menuselection:`Refresh all data` from the menu bar.
270289

271290
- **Change the order** of existing filters by hovering over a filter and using the
272291
:icon:`os-thin-drag-handle` :guilabel:`(drag handle)` icon to change the position.
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)