我想用我制作的功能替换 TreeView 标题中的默认按钮之一...我尝试以这种方式使用 xpath 但不起作用
<field name= "types_id" colspan="8" nolabel="1">
<tree options='{"deletable": false, "addable":null, "isClarkGable": false}'>
<field name="type_id"/>
<field name="fundamentation"/>
<xpath expr="//tree/button[@string='Add']" position="replace">
<button name="button_cancel" string="Mark to Cancel" type="object" icon="gtk-cancel"/>
</xpath>
</tree>
</field>
最佳答案
您使用的选项适用于字段而不是树标记。所以你的 xml 会是这样的,
<field name= "types_id" colspan="8" nolabel="1" options='{"deletable": false, "addable":null}'>
<tree delete="false" string='YOUR STRING'>
<field name="type_id"/>
<field name="fundamentation"/>
<xpath expr="//tree/button[@string='Add']" position="replace">
<button name="button_cancel" string="Mark to Cancel" type="object" icon="gtk-cancel"/>
</xpath>
</tree>
</field>
关于odoo - OpenERP TreeView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21434480/