zoukankan      html  css  js  c++  java
  • odoo filter 日期

    <!--日期-->
    <filter name="before_twodays" string="前天"
    domain="[('date','&gt;=',(context_today() - relativedelta(days=2)).strftime('%Y-%m-%d')),
    ('date','&lt;',(context_today() - relativedelta(days=1)).strftime('%Y-%m-%d'))]"/>

    <filter name="yesterday" string="昨日"
    domain="[('date','&gt;=',(context_today() - relativedelta(days=1)).strftime('%Y-%m-%d')),
    ('date','&lt;',time.strftime('%Y-%m-%d'))]"/>

    <filter name="today" string="今日"
    domain="[('date','&gt;=',(context_today().strftime('%Y-%m-%d'))),
    ('date','&lt;',(context_today() + relativedelta(days=1)).strftime('%Y-%m-%d'))]"/>

    <filter name="tomorrow" string="明日"
    domain="[('date','&gt;',time.strftime('%Y-%m-%d')),
    ('date','&lt;=',(context_today() + relativedelta(days=1)).strftime('%Y-%m-%d'))]"/>

    <filter name="after_twodays" string="后天"
    domain="[('date','&gt;',(context_today() + relativedelta(days=1)).strftime('%Y-%m-%d')),
    ('date','&lt;',(context_today() + relativedelta(days=3)).strftime('%Y-%m-%d'))]"/>

    <filter name="after_threedays" string="大后天"
    domain="[('date','&gt;',(context_today() + relativedelta(days=2)).strftime('%Y-%m-%d')),
    ('date','&lt;',(context_today() + relativedelta(days=4)).strftime('%Y-%m-%d'))]"/>

    <filter name="week" string="本周"
    domain="[('date','&gt;=',(context_today() - datetime.timedelta(days=context_today().weekday())).strftime('%Y-%m-%d')),
    ('date','&lt;',(context_today() - datetime.timedelta(weeks=-1,days=context_today().weekday())).strftime('%Y-%m-%d'))]"/>

    <filter name="week1" string="1本周"
    domain="[('date','&gt;=',(context_today() - datetime.timedelta(days=context_today().weekday())).strftime('%Y-%m-%d')),
    ('date','&lt;=',(context_today() + datetime.timedelta(days=context_today().weekday()-6)).strftime('%Y-%m-%d'))]"/>

    <filter name="after_sevendays" string="下周"
    domain="[('date','&gt;=',(context_today() - datetime.timedelta(weeks=-1,days=context_today().weekday())).strftime('%Y-%m-%d')),
    ('date','&lt;',(context_today() - datetime.timedelta(weeks=-2,days=context_today().weekday())).strftime('%Y-%m-%d'))]"/>

    <filter name="month" string="本月"
    domain="[('date','&gt;=',context_today().strftime('%Y-%m-01')),
    ('date','&lt;',(context_today() + relativedelta(months=1)).strftime('%Y-%m-01'))]"/>

    <filter name="next_month" string="下月"
    domain="[('date','&gt;=',(context_today() + relativedelta(months=1)).strftime('%Y-%m-01')),
    ('date','&lt;',(context_today() + relativedelta(months=2)).strftime('%Y-%m-01'))]"/>

    <filter name="last_week" string="上周"
    domain="[('date','&gt;=',(context_today() - relativedelta(weeks=1,days=context_today().weekday())).strftime('%Y-%m-%d')),
    ('date','&lt;',(context_today() - datetime.timedelta(days=context_today().weekday())).strftime('%Y-%m-%d'))]"/>

    <filter name="last_month" string="上月"
    domain="[('date','&gt;=',(context_today() - relativedelta(months=1)).strftime('%Y-%m-01')),
    ('date','&lt;',context_today().strftime('%Y-%m-01'))]"/>

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

    <filter name="quarter1" string="本季度"
    domain="[('date','&gt;=',datetime.date(context_today().year,((context_today().month - 1) / 3 * 3 ), 1).strftime('%Y-%m-%d')),
    ('date','&lt;',datetime.date(context_today().year,((context_today().month - 1) / 3 * 3 + 3), 1).strftime('%Y-%m-%d'))]"/>

    <separator/>

  • 相关阅读:
    AJAX 应用 透过 JavaScript 调用 C# 函数
    快速搞懂 SQL Server 的锁定和阻塞
    国际财务报告准则 IFRS 与信息系统
    我的android阅读软件“微读”做最简单的手机阅读软件
    我的android阅读软件“微读”v2.0发布,加入新浪微博的支持
    iphone开发我的新浪微博客户端用户登录等待篇(1.4)
    iphone开发我的新浪微博客户端用户登录自定义弹出窗口篇(1.2)
    自定义实现类似android主界面的滑屏换屏控件
    我的android阅读软件“微读”v2.2又发布,加入微美图、微漫画、微美女阅读
    iphone开发我的新浪微博客户端用户登录OAuth授权认证篇(1.3)
  • 原文地址:https://www.cnblogs.com/alangwansui/p/9459544.html
Copyright © 2011-2022 走看看