2016-09-27 41 views
1

我創建了一個樹視圖來擴展account.invoice模塊與自定義列和特殊列的列表。我試圖插入一個搜索視圖,但它沒有工作(我可以在樹視圖中顯示數據,但不是搜索框和我需要的其他過濾器)。OpenERP 7樹視圖不顯示搜索框和其他過濾器

XML:

<openerp> 
    <data> 
     <record model="ir.ui.view" id="view_account_invoices_resume_list"> 
     <field name="name">account.invoice.resume.tree</field> 
     <field name="model">account.invoice.resume</field> 
     <field name="type">tree</field> 
     <field name="arch" type="xml"> 
      <tree string="Invoices list"> 
       <field name="date_invoice"/> 
       <field name="number"/> 
       <field name="partner_id"/> 
       <field name="inv_vat"/> 
       <field name="tax_base_0"/> 
       <field name="tax_base_4"/> 
       <field name="tax_base_10"/> 
       <field name="tax_base_21"/> 
       <field name="tax_iva_4"/> 
       <field name="tax_iva_10"/> 
       <field name="tax_iva_21"/> 
       <field name="amount_total" sum="Total Amount"/> 
      </tree> 
     </field> 
     </record> 
     <record model="ir.ui.view" id="view_account_invoices_resume_search"> 
     <field name="name">account.invoice.resume.search</field> 
     <field name="model">account.invoice.resume</field> 
     <field name="arch" type="xml"> 
      <search string="Filtrado de facturas"> 
       <field name="date_invoice_from" filter_domain="[('date_invoice','>=',self)]"/> 
       <field name="date_invoice_to" filter_domain="[('date_invoice','<=',self)]"/> 
      </search> 
     </field> 
     </record> 
     <record model="ir.actions.act_window" id="action_account_invoices_resume_list_tree"> 
     <field name="name">Facturas para gestoría</field> 
     <field name="res_model">account.invoice.resume</field> 
     <field name="view_type">form</field><field name="view_mode">tree,form</field> 
     <field name="view_id" ref="view_account_invoices_resume_search"/> 
     <field name="domain">[('type','=','out_invoice'),('state','in',['open','paid'])]</field> 
     </record> 
     <menuitem id="menu_invoices_for_closure_list_client" name="Facturas de clientes para gestoría" parent="account.menu_finance_receivables" sequence="10" action="action_account_invoices_resume_list_tree"/> 
    </data> 
</openerp> 

回答

1

一般來說,的view_id參考樹,形式,看板...等

如果我們希望增加對目標的搜索視圖,則我們需要註冊搜索視圖ID在search_view_id

請試試以下代碼。

更換線

<field name="view_id" ref="view_account_invoices_resume_search"/> 

<field name="view_id" ref="view_account_invoices_resume_list"/> 
<field name="search_view_id" ref="view_account_invoices_resume_search"/> 

EDIT

更換線

<field name="domain">[('type','=','out_invoice'),('state','in',['open','paid'])]</field> 

<field name="domain">[('type','=','out_invoice'),('state','in',('open','paid'))]</field> 

在樹視圖中添加state字段。

然後,重新啓動服務器並升級您的模塊。

+0

它的工作原理!謝謝@Odedra。現在,我在樹視圖中出現錯誤:_Error:QWeb2 - template ['ListView.rows']:運行時錯誤:錯誤:QWeb2 - 模板['ListView.row']:運行時錯誤:錯誤:未知字段在域[[「狀態」,「不在」,[「草案」]]]中的狀態[ 在XML中,我寫道:[ [('type','=','out_invoice '),('國家','在',['打開','付款'])]' –

+0

我已經解決了:[https://github.com/odoo/odoo/issues/4430]有一個美好的一天! –

相關問題