如果过期/截止日期少于现在的日期,请更改为颜色背景红色;如果过期/日期截止日期超过现在,则更改为颜色背景绿色;如果过期/日期截止日期少于1天零3天,则更改为颜色背景橙色。
<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天。
发布于 2015-05-27 13:51:40
你有一个橙色测试的条件问题:
( ( record.eth_current_stage_deadline.raw_value gt new Date() ) and (record.eth_current_stage_deadline.raw_value - new Date() lt 3*86400000) )请注意,有两种比较如下:
(date_val > today) and (date_val - today < 3 days)值86400000 = 24 * 60 * 60 * 1000,对应一天,以毫秒为单位。
https://stackoverflow.com/questions/30449215
复制相似问题