首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在odoo改变颜色背景kanban

在odoo改变颜色背景kanban
EN

Stack Overflow用户
提问于 2015-05-26 03:57:49
回答 1查看 3.2K关注 0票数 1

如果过期/截止日期少于现在的日期,请更改为颜色背景红色;如果过期/日期截止日期超过现在,则更改为颜色背景绿色;如果过期/日期截止日期少于1天零3天,则更改为颜色背景橙色。

代码语言:javascript
复制
<div t-if="record.eth_current_stage_deadline.raw_value and record.eth_current_stage_deadline.raw_value gt (new Date())" style="margin: 0px; background-color: #00FF00;">                                                                                                               
    <b>Stage Deadline:</b> <t t-if="record.eth_current_stage_deadline.raw_value and record.eth_current_stage_deadline.raw_value lt (new Date())" t-set="redo">oe_kanban_text_red</t>
            <span t-attf-class="#{redo || ''}"><i><field name="eth_current_stage_deadline"/></i></span>    
</div>

<div t-if="record.eth_current_stage_deadline.raw_value and record.eth_current_stage_deadline.raw_value lt (new Date())" style="margin: 0px; background-color: #FF0000;">                                                                                                               
    <b>Stage Deadline:</b> <t t-if="record.eth_current_stage_deadline.raw_value and record.eth_current_stage_deadline.raw_value lt (new Date())" t-set="redo">oe_kanban_text_red</t>
            <span t-attf-class="#{redo || ''}"><i><field name="eth_current_stage_deadline"/></i></span>    
</div>

<div t-if="(record.eth_current_stage_deadline.raw_value and record.eth_current_stage_deadline.raw_value - new Date()) == 3" style="margin: 0px; background-color: #FF8C00;">                                                                                                               
    <b>Stage Deadline:</b> <t t-if="record.eth_current_stage_deadline.raw_value and record.eth_current_stage_deadline.raw_value lt (new Date())" t-set="redo">oe_kanban_text_red</t>
            <span t-attf-class="#{redo || ''}"><i><field name="eth_current_stage_deadline"/></i></span>    
</div>

我还没有找到一种方法来改变颜色背景橙色,如果过期不到1天,直到3天。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-05-27 13:51:40

你有一个橙色测试的条件问题:

代码语言:javascript
复制
( ( record.eth_current_stage_deadline.raw_value gt new Date() ) and (record.eth_current_stage_deadline.raw_value - new Date() lt 3*86400000) )

请注意,有两种比较如下:

代码语言:javascript
复制
(date_val > today) and (date_val - today < 3 days)

值86400000 = 24 * 60 * 60 * 1000,对应一天,以毫秒为单位。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30449215

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档