Skip to content

Instantly share code, notes, and snippets.

@ray-odoo
Created June 12, 2019 19:27
Show Gist options
  • Save ray-odoo/78cefaf1205e6857bf8ac329a23a8112 to your computer and use it in GitHub Desktop.
Save ray-odoo/78cefaf1205e6857bf8ac329a23a8112 to your computer and use it in GitHub Desktop.
<filter string="This Month" name="this_month" domain="['&amp;', ('date', '&gt;=', context_today().strftime('%Y-%m-01')),
('date', '&lt;', (context_today() + relativedelta(months=1)).strftime('%Y-%m-01'))]"/>
<filter string="Last Month" name="last_month1" domain="['&amp;', ('date', '&gt;=', (context_today() - relativedelta(months=1)).strftime('%Y-%m-01')),
('date', '&lt;', (context_today() - relativedelta(months=0)).strftime('%Y-%m-01'))]"/>
<filter string="2 Months Ago" name="last_month2" domain="['&amp;', ('date', '&gt;=', (context_today() - relativedelta(months=2)).strftime('%Y-%m-01')),
('date', '&lt;', (context_today() - relativedelta(months=1)).strftime('%Y-%m-01'))]"/>
<filter string="3 Months Ago" name="last_month3" domain="['&amp;', ('date', '&gt;=', (context_today() - relativedelta(months=3)).strftime('%Y-%m-01')),
('date', '&lt;', (context_today() - relativedelta(months=2)).strftime('%Y-%m-01'))]"/>
<filter string="4 Months Ago" name="last_month4" domain="['&amp;', ('date', '&gt;=', (context_today() - relativedelta(months=4)).strftime('%Y-%m-01')),
('date', '&lt;', (context_today() - relativedelta(months=3)).strftime('%Y-%m-01'))]"/>
<filter string="5 Months Ago" name="last_month5" domain="['&amp;', ('date', '&gt;=', (context_today() - relativedelta(months=5)).strftime('%Y-%m-01')),
('date', '&lt;', (context_today() - relativedelta(months=4)).strftime('%Y-%m-01'))]"/>
<filter string="6 Months Ago" name="last_month6" domain="['&amp;', ('date', '&gt;=', (context_today() - relativedelta(months=6)).strftime('%Y-%m-01')),
('date', '&lt;', (context_today() - relativedelta(months=5)).strftime('%Y-%m-01'))]"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment