Odoo 10:布尔字段旁边的输入字段

时间:2018-11-28 13:53:41

标签: xml input view boolean odoo

我想在笔记本中创建如下所示的视图,其中输入字段位于布尔字段旁边:

enter image description here

我尝试了以下代码,但没有成功:

<notebook colspan="4">
    <page name="HR Team" string="HR Team" >
         <group string="All Employees">
                 <table>
                     <td><field name="onBoardingMail" attrs="{'readonly':True}" /></td>
                      <td><field name="onBoardingMail_comment"  /></td> 
                </table>
        </group>
    </page>
</notebook>

实现该观点的正确方法是什么?

1 个答案:

答案 0 :(得分:2)

下面的视图应该起作用,并且当复选框为False时,输入字段可以是只读的。

<notebook colspan="4">
    <page name="HR Team" string="HR Team">
        <group string="All Employees">
            <label string="onBoarding Email" for="onBoardingMail_comment" class="oe_inline"/>
            <div>
                <field name="onBoardingMail" nolabel="1" class="oe_inline"/>
                <field name="onBoardingMail_comment" placeholder="This is a Comment" nolabel="1" class="oe_inline" attrs="{'readonly':[('onBoardingMail','=',False)]}"/>
            </div>
        </group>
    </page>
</notebook>

启用复选框后:

enter image description here

禁用复选框时:

enter image description here