2014-04-23 43 views
1

我想放置一個鏈接,以在窗體視圖下載文檔文件。我已經有了鏈接,並且我製作了一個實際上可以下載的自定義Web控制器,但問題在於它們出現在視圖的每個部分。我希望它根據特定條件出現,其中申請人的狀態字段設置爲與表單視圖中的按鈕類似的特定值。在表單視圖中隱藏/顯示網址在openerp

貝婁是出現基於狀態條件的按鈕的例子:

<button name="action_open_agreement_form" type="object" string="P020 Declaration and undertaking" attrs="{'invisible':[('state','!=','done')]}"/> 

這讓我展示一個按鈕,如果申請人的國家沒有這樣做。

我有這個鏈接是在XML

<record model="ir.ui.view" id="view_sefarer_applicant_form"> 
    <field name="name">Jobs - Recruitment Form</field> 
<field name="model">seafarer.applicant</field> 
<field name="arch" type="xml"> 
    <form string="Jobs - Recruitment Form" version="7.0"> 
     ... 
     <sheet> 
      ...... 
    <div class="oe_right oe_button_box"> 
       .... 
       <a href="#" onclick="window.open('/sc/some_html?id=P014-'+$('.seafarer_id span').text(), '_blank')" class="applicant_docs_forms" id="P014">P014 Drug/Alcohol Delcaration</a> 
       ..... 
      </div> 
     </sheet> 
    ..... 

我需要使用類似的attrs,但它是不工作的波紋管,我也試圖在窗口負載使用JavaScript用或文檔準備,但是這不是也工作。我也嘗試了絕望的事情,比如有一個帶有條件的attrs按鈕,並且有一個onclick動作,點擊鏈接並隱藏鏈接,但是這並不起作用。

我很絕望,任何幫助,將不勝感激。

回答

0

根據組成員資格或字段內容(例如state),您可以使整個div不可見,也可以將鏈接置於字段中,並使用相同條件使這些鏈接不可見。

相關問題