首页 文章

在odoo中更改颜色背景看板

提问于
浏览
1

如果过期/日期截止日期现在少于日期,我需要更改为彩色背景红色,如果过期/日期截止日期现在超过日期,则需要更改为彩色背景绿色,如果过期/日期截止日期不到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天 .

1 回答

  • 0

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

    ( ( 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,对应于一天(毫秒) .

相关问题