如何在odoo中过滤前一年的记录?
how to filter records for previous year in odoo?
我正在尝试使用从 odoo 相关网站获得的以下代码
<filter icon="terp-go-month" string="Last Year"
domain="[('date_from','<=', (context_today()-relativedelta(day=31,months=12,years=1)).strftime('%Y-%m-%d')),
('date_from','>=',(context_today()-relativedelta(day=1,months=1,years=1)).strftime('%Y-%m-%d'))]"
help="last year"/>
虽然似乎没有任何效果。
有人知道吗?
这是去年的例子:
<filter string="Prev Month" name="prev_month"
domain="[('data','>=',(context_today()-relativedelta(years=1)).strftime('%%Y-%%m-01')),('data','<',time.strftime('%%Y-%%m-01'))]"
/>
我正在尝试使用从 odoo 相关网站获得的以下代码
<filter icon="terp-go-month" string="Last Year"
domain="[('date_from','<=', (context_today()-relativedelta(day=31,months=12,years=1)).strftime('%Y-%m-%d')),
('date_from','>=',(context_today()-relativedelta(day=1,months=1,years=1)).strftime('%Y-%m-%d'))]"
help="last year"/>
虽然似乎没有任何效果。 有人知道吗?
这是去年的例子:
<filter string="Prev Month" name="prev_month"
domain="[('data','>=',(context_today()-relativedelta(years=1)).strftime('%%Y-%%m-01')),('data','<',time.strftime('%%Y-%%m-01'))]"
/>