zoukankan      html  css  js  c++  java
  • odoo xml 时间搜索条件

    
    

     今年

    <filter string="This Year" name="year" domain="[('date','&lt;=', time.strftime('%%Y-12-31')),('date','&gt;=',time.strftime('%%Y-01-01'))]"/>

    今天

    <filter icon="terp-go-today" string="Today" domain="[('date','&lt;=', datetime.datetime.combine(context_today(), datetime.time(23,59,59))), ('date','&gt;=', datetime.datetime.combine(context_today(), datetime.time(0,0,0)))]"/> 

    上月
    ('date', 'like', (context_today() - datetime.timedelta(month=1)).strftime('%%Y-%%m'))  
    ('date', 'like', (context_today() - relativedelta(month=1)).strftime('%%Y-%%m')) 

    ('picking_type_id','=',%(mtlcs_stock.picking_type_material_production)d ),('date','&lt;', time.strftime('%%Y-%%m-01')),('date','&gt;=',  (context_today() - relativedelta(months=1)).strftime('%%Y-%%m-01') ) 

    ('date', '&gt;=', ((context_today()+relativedelta(weeks=-2, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))),('date', '&lt;=', ((context_today()+relativedelta(weeks=-1, weekday=6)).strftime('%%Y-%%m-%%d')))

    上周日
    ('date', '&lt;=', ((context_today()+relativedelta(weeks=-1, weekday=6)).strftime('%%Y-%%m-%%d'))) 

    上周一
    ('date', '&gt;=', ((context_today()+relativedelta(weeks=-2, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))) 

    本周一
    ('date', '&gt;=', ((context_today()+relativedelta(weeks=-1, weekday=0)).strftime('%%Y-%%m-%%d'))) 

    实例:

    <record id="inherit_iew_move_search" model="ir.ui.view">
                <field name="name">inherit.stock.move.search</field>
                <field name="model">stock.move</field>
                <field name='inherit_id' ref='stock.view_move_search'/>
                <field name="arch" type="xml">
                    <field name="name" position="after">
                        <field name="date" string="开始时间" filter_domain="[('date','>',self)]"/>
                        <field name="date" string="结束时间" filter_domain="[('date','<',self)]"/>
                    </field>
    
                    <filter name="ready" position="after">
                        <filter string="领料" name="slip"
                                domain="[('state','=','done'),('picking_type_id','=',%(mtlcs_stock.picking_type_material_production)d )]"/>
                        
                        <filter string="今日领料" name="slip1"
                                domain="[('state','=','done'),('picking_type_id','=',%(mtlcs_stock.picking_type_material_production)d ),('date', '<=', datetime.datetime.combine(context_today(), datetime.time(23,59,59))),('date','>=', datetime.datetime.combine(context_today(), datetime.time(0,0,0)))]"/>
                        <filter string="本周领料" name="slip2"
                                domain="[('state','=','done'),('picking_type_id','=',%(mtlcs_stock.picking_type_material_production)d ),('date', '>=', ((context_today()+relativedelta(weeks=-1, weekday=0)).strftime('%%Y-%%m-%%d'))), ]"/>
                        <filter string="本月领料" name="slip3"
                                domain="[('state','=','done'),('picking_type_id','=',%(mtlcs_stock.picking_type_material_production)d ),('date', 'like', time.strftime('%%Y-%%m'))]"/>
                        <filter string="上月领料" name="slip4"
                                domain="[('state','=','done'),('picking_type_id','=',%(mtlcs_stock.picking_type_material_production)d ),('date', '<', time.strftime('%%Y-%%m-01')),('date','>=', (context_today() - relativedelta(months=1)).strftime('%%Y-%%m-01'))]"/>
                        <separator/>
    
                        <filter string="退料" name="slip_return"
                                domain="[('state','=','done'),('picking_type_id','=',%(mtlcs_stock.picking_type_material_production_return)d )]"/>
                        <filter string="收货" name="purchase"
                                domain="[('state','=','done'),('picking_type_id','=',%(stock.picking_type_in)d )]"/>
                        <filter string="退货" name="purchase_return"
                                domain="[('state','=','done'),('picking_type_id','=',%(mtlcs_stock.picking_type_purchase_input_return)d )]"/>
                    </filter>
                    <group string="Group By" position="inside">
                        <filter string="部门" name="groupby_department" icon="terp-gtk-jump-to-rtl" domain="[]"
                                context="{'group_by':'department_id'}"/>
                    </group>
                </field>
            </record>
  • 相关阅读:
    CAS与ABA问题产生和解决
    OnCheckedChangeListener和setChecked之间冲突问题解决
    【二】 在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否函数该整数。
    【一】设计一个类,我们只能生成该类的一个实例。
    深入学习semaphore
    RF-For循环使用
    【RF库Collections测试】List Should Contain Value
    RF采用SSHLibary库执行sudo命令,提示sudo: sorry, you must have a tty to run sudo错误的解决办法
    【RF库Collections测试】List Should Contain Value
    RF判断列表、字典、整数、字符串类型是否相同方法
  • 原文地址:https://www.cnblogs.com/dancesir/p/6893224.html
Copyright © 2011-2022 走看看