Odoo中本日、本月、上月过滤器实现方法

Odoo中本日、本月、上月过滤器实现方法
<filter string="今日订单" name="today" invisible="0" domain="[('date','=', current_date)]"/>
<filter string="本月订单" name="month" invisible="0" domain="[('date','>=', time.strftime('%Y-%m-01')),('date','<', (context_today() + relativedelta(months=1)).strftime('%Y-%m-01') ) ]"/>
<filter string="上月订单" name="month2" invisible="0" domain="[('date','<', time.strftime('%Y-%m-01')),('date','>=', (context_today() - relativedelta(months=1)).strftime('%Y-%m-01') ) ]"/>
<filter string="本年订单" name="year" invisible="0" domain="[('date','<=', time.strftime('%Y-12-31')),('date','>=', time.strftime('%Y-01-01'))]"/>

【Odoo过滤器中可以使用的时间变量】

    datetime: datetime,
    context_today: context_today,
    time: time,
    relativedelta: relativedelta,
    current_date

原文地址:https://www.zhiyunerp.com/forum/erp-1/question/odoo-354

转载于:https://blog.51cto.com/siweilai/2318886

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值