<!--日期-->
<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/>

odoo filter 日期的更多相关文章

  1. 解决-Django使用filter过滤时间,无法获取月份的问题

    django中的filter日期查询属性有:year.month.day.week_day.hour.minute.second 但是但我在使用过滤查询是却总是无法过滤出月份,各种查资料,最后才发现是 ...

  2. Django中ORM过滤时objects.filter()无法对月份过滤

    django中的filter日期查询属性有:year.month.day.week_day.hour.minute.second 在做复习博客项目时,我把项目从linux移到了windows,然后博客 ...

  3. django 操作数据库--orm(object relation mapping)---models

    思想 django为使用一种新的方式,即:关系对象映射(Object Relational Mapping,简称ORM). PHP:activerecord Java:Hibernate C#:Ent ...

  4. layui在odoo12上的应用,用widget覆盖原字段视图

    layui是一个前端框架,提供了许多前端的组件等,layui的详情自己官网地址:https://www.layui.com/doc/去查看 下面说一下最近用layui遇到的问题和解决方式: 问题:近期 ...

  5. AngularJS过滤器filter-时间日期格式-渲染日期格式-$filter

    今天遇到了这些问题索性就 写篇文章吧 话不多说直接上栗子 不管任何是HTML格式还是JS格式必须要在  controller 里面写 // new Date() 获取当前时间 yyyy-MM-ddd ...

  6. angularjs中的filter(过滤器)——格式化日期的date

    date过滤器的功能是基于要求的格式格式化一个日期成为一个字符串. 格式化字符串的基本参数: 'yyyy': 用4位数字表示年(例如:AD 1 => 0001, AD 2010 => 20 ...

  7. Angularjs在控制器(controller.js)的js代码中使用过滤器($filter)格式化日期/时间实例

    Angularjs内置的过滤器(filter)为我们的数据信息格式化提供了比较强大的功能,比如:格式化时间,日期.格式化数字精度.语言本地化.格式化货币等等.但这些过滤器一般都是在VIEW中使用的,比 ...

  8. 解决Odoo日期(时间)无效的问题 [转]

    环境Server: Ubuntu Kylin 14 + GreenOdoo-7.0-linux64, GreenOdoo-8.0-linux64客户端: winXP+firefox 31 (类似问题发 ...

  9. angular input使用输入框filter格式化日期

    最近使用angular日期选取器.只需要把所选的输出迄今input输入框,根据默认的假设,显示是在时间的形式的时间戳.不符合规定.需要格成一个特定的公式格公式.但input上ng-model不能直接对 ...

随机推荐

  1. iOS7默认状态栏文字颜色为黑色,项目需要修改为白色。

    1在Info.plist中设置UIViewControllerBasedStatusBarAppearance 为NO2 在需要改变状态栏颜色的 AppDelegate中在 didFinishLaun ...

  2. 【转载】Myeclipse中实现js的提示

    近期需要大量使用JS来开发,但是MyEclipse2014自带的JS编辑器没有代码提示的功能,开发效率有点低,所以安装了一个Spket的插件,过程非常简单,SVN插件的安装比这个更简单. Spket插 ...

  3. 在一个form表单中根据不同按钮实现多个action事件

    <form id="writeForm" method="post"> <div class="write-btn-tj" ...

  4. tensorflow 线性回归解决 iris 2分类

    # Combining Everything Together #---------------------------------- # This file will perform binary ...

  5. Ueditor文本编辑工具栏自定义

    1.找到 ueditor.config.js 文件 2.在 toolbars 数组内进行删减,添加 , toolbars: [[ 'fullscreen', 'source', '|', 'undo' ...

  6. June 26,程序破解

    1.android程序破解练习初级 方法一: 文件名:KeygenMe#1.apk工具:ApktoolGui v2.0 Final 先用ApktoolGui v2.0 Final反编译成java通过查 ...

  7. ROM的分类

    转载自:http://www.ic37.com/htm_tech/2012-5/82774_23811.htm ROM(只读存储器)按其内容写入方式,一般分为3种:固定内容ROM:可一次编程PROM: ...

  8. 深度学习网络结构中超参数momentum了解

    训练网络时,通常先对网络的初始权值按照某种分布进行初始化,如:高斯分布.初始化权值操作对最终网络的性能影响比较大,合适的网络初始权值能够使得损失函数在训练过程中的收敛速度更快,从而获得更好的优化结果. ...

  9. Thrift之代码生成器Compiler原理及源码详细解析1

    我的新浪微博:http://weibo.com/freshairbrucewoo. 欢迎大家相互交流,共同提高技术. 又很久没有写博客了,最近忙着研究GlusterFS,本来周末打算写几篇博客的,但是 ...

  10. Tyvj1052(树形DP)

    P1052 没有上司的舞会 时间: 1000ms / 空间: 131072KiB / Java类名: Main 描述 Ural大学有N个职员,编号为1~N.他们有从属关系,也就是说他们的关系就像一棵以 ...