继承xml中的继承视图

时间:2017-10-16 10:57:17

标签: openerp odoo-8

在'product.template'中我需要添加两个字段,因为我在xml文件中编写了一个视图,但问题是'accounts'的'inherit_id'继承自'product.product_template_form_view'。我应该如何使用inherit_id在我的档案中。 我尝试使用下面的代码,但它显示错误,请帮助我

account.product_view.xml代码:

 <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>

我需要在'taxes_id'字段下添加'cgst_id'字段。

1 个答案:

答案 0 :(得分:1)

你不需要提供完整的路径。

尝试使用以下代码:

<field name="taxes_id" position="after">
    <field name="cgst_id"/>
</field>
相关问题