Odoo Studio makes it easy to add filters to a view.
Start by enabling Developer Mode and click on the Studio icon.
Select “Views” and then the Search View. The following screen is displayed:
Now drag the “filter” handle to the list of filters. A pop-up window is displayed for you to define the filter you want to add:
For this example we will select variants with an internal reference that contains “blue”.
Click on “Save”, exit Studio and your filter has been added
We can now check what Odoo Studio has done.
Navigate to Settings / Technical / Views and enter some search criteria (“Studio” on its own will show all views created by Odoo Studio, you can select Search View from the standard filters, and it’s also possible to limit it to views for the
A new Search View has been created.
- View Name: Odoo Studio: product.product.search.stock.form customization
- View Type: Search
- Sequence: 99
- Inherited View:
- View inheritance mode: Extension View
- Model Data: Odoo Studio: product.product.search.stock.form customization
- External ID
The View Name (1) is descriptive and can be anything. The View Type (2) is always Search. The model (3) in this example is
product.product (Product Variants) and the Inherited View (5) must be for the same model. This will always be an Extension View (6) because we are “extending” an existing view.
name="Blue filter" string="New filter"/></xpath>
This means that a new filter has been added after “inactive” and the domain is that the Internal Reference [
default_code] contains ‘blue’
The filter name is actually assigned by Studio, and I changed it manually to “Blue filter”. Note that this new filter could be manually set as a default – that’s done on the Windows Action.
“New filter” isn’t a very good description and the string can be changed to something more meaningful.