Odoo Help

Francesco OpenCode
On 4/24/13, 3:44 PM

This is a correct way to filter the current month. Use it to create your own filter:

<filter string="Current Month" name="current_month" domain="[('data','&lt;',(context_today()+relativedelta(months=1)).strftime('%%Y-%%m-01')), ('data','&gt;=',time.strftime('%%Y-%%m-01'))]"/>

This is an example of previous month:

<filter string="Prev Month" name="prev_month" domain="[('data','&gt;=',(context_today()-relativedelta(months=1)).strftime('%%Y-%%m-01')),('data','&lt;',time.strftime('%%Y-%%m-01'))]"/>

The problem is, maybe, in another point

Francesco OpenCode
on 6/19/13, 10:31 AM
Niraj Pajwani
On 5/17/16, 5:51 AM

This is an example of 'Last Year':

<filter string="Last Year" domain="[('reg_date','&gt;=',(context_today()-relativedelta(years=1)).strftime('%%Y-01-01')),('reg_date','&lt;=', time.strftime('%%Y-01-01'))]"/>

This is an example of 'Last Month':

<filter string="Last Month" domain="[('reg_date','&gt;=',(context_today()-relativedelta(months=1)).strftime('%%Y-%%m-01')),('reg_date','&lt;',time.strftime('%%Y-%%m-01'))]"/>

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


Asked: 4/24/13, 6:22 AM
Seen: 10418 times
Last updated: 8/26/17, 7:23 PM