Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
2024 Tampilan

Is there a way in the UI to filter by relative dates e.g. "today", "tomorrow" "today + 5 days" please?

Avatar
Buang
Jawaban Terbai

Have a look at the filters for Leads Menu (when that feature is activated):

They use:

domain="[('my_activity_date_deadline', '[either less than, equal or greater than]', context_today().strftime('%Y-%m-%d'))]"

https://github.com/odoo/odoo/blob/15.0/addons/crm/views/crm_lead_views.xml#L681


Then have a look at the filters for Website Visitors:


It uses:

[('last_connection_datetime', '>', datetime.datetime.now() MINUS OR PLUS datetime.timedelta(days=CHANGE THE NUMBER HERE))]

https://github.com/odoo/odoo/blob/15.0/addons/website/views/website_visitor_views.xml#L261

By using a combination of the two approaches you should get every combination you want.

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
2
Okt 25
2575
1
Sep 25
2569
3
Jul 25
4013
1
Mei 25
2121
4
Mei 25
3457