【问题标题】:How to display a field on a tree view by using xpath?如何使用 xpath 在树视图上显示字段?
【发布时间】:2015-12-08 10:35:38
【问题描述】:

我一直在尝试使用 xpath 替换另一个类的树视图中的字段。

<xpath expr="//form/sheet/notebook/page/group/field/tree/field[@name='test']" position="replace">
<field name="parts_id2" style="width:30%%" attrs="{'invisible':[('sts','not in',['release'])]}"/>
</xpath>

但该字段不会出现在树视图上,而是有时会出现在树之外的其他地方。

【问题讨论】:

  • 你能详细解释一下吗.. 为什么用 style="width:30%%" 不好
  • many2one 下拉框有时会出现在树的其他地方,有时会出现在树视图行中
  • 你上次使用这个 //sheet//notebook//tree//field[@name="test"]

标签: xml xpath openerp odoo-8 openerp-8


【解决方案1】:

试试这个代码

link

    <xpath expr='//field[@name="ids name"]/tree//field[@name="test"]' position="replace">
          <field name="parts_id2" style="width:30%%" attrs="{'invisible':[('sts','not in',['release'])]}"/>
    </xpath>

expr='//field[@name="parts_lines"]/tree//field[@name="test"]'

<xpath expr='//field[@name="parts_lines"]/tree//field[@name="test"]' position="attributes">
          <attribute name="invisible">1</attribute>
 </xpath>
 <xpath expr='//field[@name="parts_lines"]/tree//field[@name="test"]' position="replace">
          <field name="parts_id2" style="width:30%%" attrs="{'invisible':[('sts','not in',['release'])]}"/>
 </xpath>

//sheet//notebook//tree//field[@name="test"]

【讨论】:

  • ID 名称是什么?树视图的 id ?
  • 树视图父字段名称
  • user00000341 首先谢谢你,但它随机出现在树视图本身之外
  • tyr it expr='//field[@name="parts_lines"]/tree//field[@name="test"]' 它在我身边工作,我希望对你有用
猜你喜欢
  • 1970-01-01
  • 2018-04-03
  • 1970-01-01
  • 1970-01-01
  • 2022-01-10
  • 2018-11-22
  • 2016-08-22
  • 1970-01-01
  • 2022-11-16
相关资源
最近更新 更多