使用继承视图扩展pos.category表单,如何使用xpath在表单的第一部分附加智能按钮
<record id="view_pos_category_inherited_form" model="ir.ui.view"> <field name="name">view.pos_category.inherited.form</field> <field name="model">pos.category</field> <field name="inherit_id" ref="point_of_sale.product_pos_category_form_view" /> <field name="arch" type="xml"> <xpath expr="//form" position="inside"> <sheet> <header> <button class="oe_stat_button" name="" icon="fa-th-list" type="action" context="{'search_default_create_uid': uid}"> <div class="o_field_widget o_stat_info"> <span class="o_stat_value"><field name="user_categories_count"/></span> <span class="o_stat_text"> Categories</span> </div> </button> </header> </sheet> </xpath> </field> </record>
不添加 <sheet> 标记之前 <header> 标签就像击中一样
<sheet>
<header>
<xpath> <header></header> <sheet></sheet> </xpath>
您的xpath是正确的,只是做了此更改,它将正常工作