我想在笔记本中创建如下所示的视图,其中输入字段位于布尔字段旁边:
我尝试了以下代码,但没有成功:
<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>
实现该观点的正确方法是什么?
答案 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>
启用复选框后:
禁用复选框时: