2016-09-27 112 views
0

我創建了4個字段(名稱,日期,用戶,描述)的簡單模塊.Below是我的.xml文件。Odoo 9添加列到網格視圖

<?xml version="1.0" encoding="utf-8"?> 
<openerp> 
     <data> 

      <record id="view_my_report_form" model="ir.ui.view"> 
      <field name="name">penalty.form</field> 
      <field name="model">my.report</field> 
      <field eval="2" name="priority"/> 
      <field name="arch" type="xml"> 
       <form string="Project"> 

        <sheet string="My report"> 

        <group> 
         <div class="oe_title"> 
          <h1 class="o_row"> 
           <field name="name" placeholder="Name..." /> 
          </h1> 
         </div> 
        </group> 
        <group> 
         <field name="user" placeholder="User..."/> 
        </group> 
        <group> 
         <field name="date" placeholder="Date..."/> 
        </group> 
        <notebook> 
         <page name="description_page" string="Description"> 
          <field name="description"/> 
         </page> 
        </notebook> 
        </sheet> 
       </form> 
      </field> 
     </record> 

     <record model="ir.actions.act_window" id="action_my_report_form"> 
      <field name="name">Add new</field> 
      <field name="res_model">my.report</field> 
     </record> 
     <menuitem name="MY report" id="menu_penalty" action="action_my_izvjestaj_form" sequence="1"/>  
    </data> 
</openerp> 

從網格視圖中的菜單中打開時,visble只是名稱。

https://postimg.org/image/ccms5aww3/

如何添加日期和用戶領域?

回答

1

您需要爲該模型聲明樹視圖。

<!-- Tree Views BEGIN--> 
    <record model="ir.ui.view" id="view_my_report_tree"> 
    <field name="name">penalty.tree</field> 
    <field name="model">my.form</field> 
    <field name="arch" type="xml"> 
     <tree string="Project"> 
      <field name="name"/> 
      <field name="user"/> 
      <field name="date"/> 
     </tree> 
    </field> 
    </record>