请可以帮助我准确地理解代码的这一部分(带有Odoo的XML)<attribute>
标签
<xpath expr="//tree/field[@name='account_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='number']" position="attributes">
<attribute name="string">PO Number</attribute>
<attribute name="readonly">0</attribute>
</xpath>
答案 0 :(得分:0)
第一个XPath表达式使嵌入式树视图的字段account_id
不可见。实际上,它正在将属性invisible="1"
添加到看起来像这样的字段中:
<tree>
<field name="name" />
<!-- some other fields -->
<field name="account_id" invisible="1" />
</tree>
第二个XPath正在为继承的视图中的属性string
等于“ number”的第一个字段定义添加/更改属性readonly
和name
。 string
是该视图中的字段标签,显然已更改为通常标签以外的其他内容,并且看起来该字段通常是只读的,被readonly="0"
更改为可读。
答案 1 :(得分:0)
这意味着:
invisble = 1
===>计算字段并隐藏它。name
===>当前字段的标签。readonly = 0
===>我们可以编辑此字段的值。如果readonly = 1
字符,我们可以看到该字段,但不能编辑该字段