2017-04-26 8 views
0

私が初心者で、これが私が取り組んでいる最初のモジュールなので、簡単な例を見つけるために多くを検索しました。私が見つけたすべての例は、理解するのが少し難しいか、私の必要性に応えられません。Odoo 10:ボタンからXMLビューを開く

私は3つのモデルがあります: 製品私は、製品のビューからproduct_packageを作成する必要が パッケージ Product_package(私は私のプロジェクトのデシベルの概念に基づいて従属テーブルとしてこれを維持する必要があります)

を。

私は、ビュー/のProduct.xmlページで試してみました:

<record model="ir.ui.view" id="product_form_view"> 
     <field name="name">product.form</field> 
     <field name="model">tjara.product</field> 
     <field name="arch" type="xml"> 
      <form string="Produit Form"> 
       <head> 
        <button name="%(product_package_list_action2)d" type='action' string='Ajouter Emballage'/> 
       </head> 
       <sheet> 
        <group> 
         <field name="name"/> 
         <field name="add_date"/> 
        </group> 
        <notebook> 
         <page string="Description"> 
          <label for="description" string="Fiche du produit"/> 
          <field name="description"/> 
         </page> 
         <page string="Fournisseurs"> 
          <label for="provider_ids"/> 
          <field name="provider_ids"/> 
         </page> 
         <page string="Clients"> 
          <label for="client_ids"/> 
          <field name="client_ids"/> 
         </page> 
        </notebook> 

       </sheet> 
      </form> 
     </field> 
    </record> 

そして、私が追加したのと同じページにある:

<record model="ir.actions.act_window" id="product_package_list_action2"> 
     <field name="name">Emballages</field> 
     <field name="res_model">tjara.product_package</field> 
     <field name="view_type">form</field> 
     <field name="view_mode">tree,form</field> 
     <field name="view_id" ref="product_package_form_view"/> 
    </record> 

をいずれかがこれを達成するためのソリューションを持っていますか?

答えて

0

私は解決策を見つけました。

:私はこのコードを持っているPRODUCT_PRICEのXMLページで

<record model="ir.actions.act_window" id="product_package_list_action2"> 
     <field name="name">Emballages</field> 
     <field name="res_model">tjara.product_package</field> 
     <field name="view_type">form</field> 
     <field name="view_mode">tree,form</field> 
     <field name="view_id" ref="product_package_form_view"/> 
    </record> 

:私は次のように挿入し、同じページで

    <header> 
         <button name="%(product_package_list_action2)d" type='action' string='Ajouter Emballage'/> 
        </header> 

この

は、製品のXMLページ内のボタンです
<record model="ir.ui.view" id="product_package_form_view"> 
     <field name="name">product_package.form</field> 
     <field name="model">tjara.product_package</field> 
     <field name="arch" type="xml"> 
      <form string="Emballage Form"> 
       <sheet> 
        <group> 
         <field name="product_id"/> 
         <field name="package_id"/> 
         <field name="price"/> 
        </group> 
        <notebook> 
         <page string="Description"> 
          <field name="description"/> 
         </page> 
        </notebook> 

       </sheet> 
      </form> 
     </field> 
    </record> 

マニフェストでは、製品Xmlの前にproduct_packageをロードします。これは、ポップアップウィンドウの代わりにフルページを取得しても、私の問題を解決します。

関連する問題