2017-10-16 187 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