In odoo 16 I have done a lot of dashboard and I need to set filter for periods from 1 Jan to 2 Feb. and the periods is drop down and I need to set specific date range
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Buchhaltung
- Lager
- PoS
- Project
- MRP
Diese Frage wurde gekennzeichnet
Date Filter
Hii,
Option 1: Use Predefined Filters with Domain in XML Search View
You can add predefined filters with fixed date ranges in your search view XML like this:
<record id="view_your_model_search" model="ir.ui.view">
<field name="name">your.model.search</field>
<field name="model">your.model</field>
<field name="arch" type="xml">
<search>
<!-- Existing filters -->
<filter string="1 Jan to 2 Feb" name="period_jan_feb"
domain="[
('date_field', '>=', '2025-01-01'),
('date_field', '<=', '2025-02-02')
]"/>
<filter string="3 Feb to 31 Mar" name="period_feb_mar"
domain="[
('date_field', '>=', '2025-02-03'),
('date_field', '<=', '2025-03-31')
]"/>
</search>
</field>
</record>
Replace 'date_field' with your actual date field name.
This will add a dropdown filter with these periods users can just click to filter.
Option 2: Use the Built-in Date Filters Widget
Odoo’s search views also support:
- Date Range widget on date fields (users pick custom ranges),
- Predefined time periods (like last month, this year) out of the box.
You can add a date filter on your date field to allow quick selection:
<filter string="Date" name="date_filter" domain="[]" context="{'group_by':'date_field'}"
help="Filter by date">
<field name="date_field" filter_domain="[]"/>
</filter>
Users will get a calendar popup and predefined options (week, month, year, custom).
i hope it is use full
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!
Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!
RegistrierenVerknüpfte Beiträge | Antworten | Ansichten | Aktivität | |
---|---|---|---|---|
|
1
Jan. 25
|
17861 | ||
|
1
Jan. 20
|
3845 | ||
|
1
Dez. 19
|
6273 | ||
|
1
Dez. 19
|
17200 | ||
|
3
Apr. 18
|
5100 |