如何使用今天作为过滤器为树形视图中的字段着色 [英] How to color a field in tree view with today as filter

查看:65
本文介绍了如何使用今天作为过滤器为树形视图中的字段着色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是openERP的新手.我正在为Due_date小于Today的那些记录更改树形视图的颜色.这些记录应为红色.

I am new to openERP. I am working on changing the color in tree view for those record whose due_date is less then Today. Those record should be in red color.

我无法在树状视图中获取当前日期作为过滤器.

I am not able to get the current date as filter in tree view.

xml我需要什么,但不起作用:

xml what I need but not working:

<tree colors="blue:Due_date < Today()" string="Invoice">
                    <field name="Due_date" />
                    <field name="date_invoice"/>
                    <field name="state"/>
                </tree>

工作代码

<tree colors="blue:state == 'open'" string="Invoice">
                    <field name="partner_id" groups="base.group_user"/>
                    <field name="date_invoice"/>                      
                    <field name="state"/>
                </tree>

我尝试过

context_today()

datetime.datetime.now()

什么都没做.

请帮助我.

推荐答案

.xml端不支持<, >, <=, >=.所以我们需要使用&lt;, &gt;, &lt;= and &gt;=

In .xml side <, >, <=, >= is not supported. So we need to use &lt;, &gt;, &lt;= and &gt;=

这将起作用,尝试一下,

This will work, try this,

<tree colors="blue:due_date &lt; current_date;" string="Invoice">
    <field name="Due_date" />
    <field name="date_invoice"/>
    <field name="state"/>
</tree>

这篇关于如何使用今天作为过滤器为树形视图中的字段着色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆