phani
phani

Reputation: 131

inheriting the inherit view in xml

In 'product.template' I need to add two fields for that I written one view in xml file but the problem is 'inherit_id' of 'accounts' is inheriting from 'product.product_template_form_view'.so how should I use inherit_id in my file. I tried with below code but it was showing error please help me

account.product_view.xml code:

 <record id="product_template_form_view" model="ir.ui.view">
        <field name="name">product.template.form.inherit</field>
        <field name="model">product.template</field>
        <field name="priority">5</field>
        <field name="inherit_id" ref="product.product_template_form_view"/>
        <field name="arch" type="xml">
            <page string="Sales" position="after">
                <page string="Accounting" groups="account.group_account_invoice">
                    <group>
                        <label for="categ_id" string="Internal Category"/>
                        <div><field name="categ_id" colspan="3" nolabel="1"/></div>
                    </group>
                    <group name="properties">
                        <group>
                            <field name="property_account_income" domain="[('type','=','other')]" groups="account.group_account_user"/>
                            <field name="taxes_id" colspan="2" widget="many2many_tags" required="1"/>
                        </group>
                        <group>
                            <field name="property_account_expense" domain="[('type','=','other')]" groups="account.group_account_user"/>
                            <field name="supplier_taxes_id" colspan="2" widget="many2many_tags" required="1"/>
                        </group>
                    </group>
                </page>
            </page>
        </field>
    </record>

mycode:

<record model="ir.ui.view" id="gst_account_view_inherit">
        <field name="name">gst_account_view_add_form_inherit</field>
        <field name="model">product.template</field>
        <field name="inherit_id" ref="account.product_template_form_view"/>
        <field name="arch" type="xml">
                <data>
                    <xpath expr="//field/page/page/group/group/field[@name='taxes_id']" position="after">                       
                        <field name="cgst_id"/>                         
                    </xpath>
                </data>
        </field>
    </record>

I need to add my 'cgst_id' field under 'taxes_id' field.

Upvotes: 1

Views: 223

Answers (1)

Bhavesh Odedra
Bhavesh Odedra

Reputation: 11143

You don't need to give full path.

Try with these code:

<field name="taxes_id" position="after">
    <field name="cgst_id"/>
</field>

Upvotes: 1

Related Questions