2017-10-16 133 views
1

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

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> 

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

回答

1

你不需要给完整路径。

尝试用这些代码:

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

它的工作谢谢 – phani