Skip to Content
Menu
This question has been flagged
1 Reply
2538 Views

Hi let me know how I can set the default filter as "Current month and upcoming month".


I have seen some similar code like


Eg: - 

Today 2022 May 30th, so default filter is should show May & June month

If the current date June 1 then default filter should show June and July month 


Thanks in Advance

Avatar
Discard
Best Answer

Hi, 

You can try the below:

<filter name="two_month" string="Two Months" domain="[
('date', '&gt;=', (context_today()).strftime('%%Y-%%m-01')),
('date', '&lt;=', (context_today() + relativedelta(months=1,day=31)).strftime('%%Y-%%m-%%d'))]"/>

Avatar
Discard
Author

Thank you so much..! It's working.