Search code examples
pythonxmlodooodoo-11

Extend the res.user to link with categories created by the specific user


Extend the pos.category form with inherited view, How can I append a smart button at first part of the form with 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>

Solution

  • Do not add <sheet> tag before <header> tag. Just code like hit

    <xpath>
    <header></header>
    <sheet></sheet>
    </xpath>
    

    Your xpath is correct just done this change and it will work