【问题标题】:Add color to checkbox in Odoo10 according to condition根据条件为Odoo10中的复选框添加颜色
【发布时间】:2019-11-14 06:20:55
【问题描述】:

需要根据树视图装饰器等条件为列表视图中的复选框添加颜色。 如果树视图中的任何行不满足特定条件,则需要更改 odoo 10 中复选框的颜色

【问题讨论】:

    标签: javascript css treeview odoo odoo-10


    【解决方案1】:

    将此代码添加到您的模块/static/src/xml/file.xml

    <tr t-extend="ListView.row">
        <t t-jquery="td[class='o_list_record_selector']" t-operation="replace">
            <td t-if="options.selectable" class="o_list_record_selector">
                <t t-set="checked" t-value="options.select_view_id == record.get('id') ? 'checked' : null"/>
                <input t-if="options.radio" type="radio" name="radiogroup" t-att-checked="checked"/>
                <t t-if="view.model == 'account.asset.asset'">
                    <t t-if="asData.state.value == 'make_draft'">
                        <div t-if="!options.radio" class="o_checkbox">
                            <input type="checkbox" name="radiogroup" style="outline-color: solid !important; outline-style: auto;" t-att-checked="checked"/><span/>
                        </div>
                    </t>
                    <t t-if="asData.state.value == 'draft'">
                        <div t-if="!options.radio" class="o_checkbox">
                            <input type="checkbox" name="radiogroup" style="outline-color: green !important; outline-style: auto;" t-att-checked="checked"/><span/>
                        </div>
                    </t>
    
                </t>
                <t t-if="view.model != 'account.asset.asset'">
    
                    <div t-if="!options.radio" class="o_checkbox">
                        <input type="checkbox" name="radiogroup" t-att-checked="checked"/><span/>
                    </div>
                </t>
            </td>
        </t>
    </tr>
    

    【讨论】:

    • 感谢您的帮助,当单击复选框轮廓颜色消失时,是否有任何方法可以始终在复选框上显示颜色
    猜你喜欢
    • 1970-01-01
    • 2015-10-06
    • 2018-06-25
    • 1970-01-01
    • 2020-01-14
    • 2016-07-26
    • 1970-01-01
    • 2021-07-13
    • 2019-04-09
    相关资源
    最近更新 更多