XML属性标签

时间:2018-09-06 08:56:35

标签: xml odoo

请可以帮助我准确地理解代码的这一部分(带有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>

2 个答案:

答案 0 :(得分:0)

第一个XPath表达式使嵌入式树视图的字段account_id不可见。实际上,它正在将属性invisible="1"添加到看起来像这样的字段中:

<tree>
    <field name="name" />
    <!-- some other fields -->
    <field name="account_id" invisible="1" />
</tree>

第二个XPath正在为继承的视图中的属性string等于“ number”的第一个字段定义添加/更改属性readonlynamestring是该视图中的字段标签,显然已更改为通常标签以外的其他内容,并且看起来该字段通常是只读的,被readonly="0"更改为可读。

答案 1 :(得分:0)

这意味着:

  1. invisble = 1 ===>计算字段并隐藏它。
  2. name ===>当前字段的标签。
  3. readonly = 0 ===>我们可以编辑此字段的值。

如果readonly = 1字符,我们可以看到该字段,但不能编辑该字段