OpenERP树视图

OpenERP树视图,openerp,odoo,Openerp,Odoo,我想将treeview标题中的一个默认按钮替换为一个由我的。。。我尝试以这种方式使用xpath,但没有成功 <field name= "types_id" colspan="8" nolabel="1"> <tree options='{"deletable": false, "addable":null, "isClarkGable": false}'> <field name

我想将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>

您使用的选项用于字段而不是树标记。因此,您的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>


我发现你的代码错了。为了纠正这个问题,你能展示一下你的整个xml文件吗?我发现你的代码错了。若要更正此问题,请显示整个xml文件。但它显示了一个错误您可以在odoo 9yes中使用字符串作为元素选择器,在odoo 9中,您需要使用名称作为选择器元素,而不是xpath中的字符串。但它显示了一个错误您可以在odoo 9yes中使用字符串作为元素选择器,在Odoo9中,您需要使用name作为选择器元素,而不是xpath上的字符串。