2013-04-08 70 views
0

我需要隱藏「分隔符」及其所有子項(樹,字段,按鈕等),我卡住了,不知道如何實現這個在XML視圖中隱藏「分隔符」 - OpenErp

<separator string="Quotations" /> 
        <field name="purchase_ids" readonly="1"> 
         <tree string="Purchase Order"> 
          <field name="name" string="Reference"/> 
          <field name="date_order" string="Order Date"/> 
          <field name="partner_id"/> 
          <field name="company_id" groups="base.group_multi_company" widget="selection"/> 
          <field name="location_id" groups="stock.group_locations"/> 
          <field name="minimum_planned_date"/> 
          <field name="origin"/> 
          <field name="state"/> 
          <button name="purchase_cancel" states="draft,confirmed,wait_auth" string="Cancel Purchase Order" icon="gtk-cancel"/> 
          <button name="purchase_confirm" states="draft" string="Confirm Purchase Order" icon="gtk-apply"/> 
          <button name="purchase_approve" states="confirmed" string="Approved by Supplier" icon="gtk-ok"/> 
         </tree> 
        </field> 

如果有人可以幫忙,將非常感激,非常感謝您提前!

回答

2

如果你需要隱藏特定的角色/組字段,您可以使用組屬性是這樣的:

<field name="name" groups="GROUP_XML_ID"/> 

這意味着如果您當前的用戶沒有這個組,他將無法看到這些字段。

如果你需要隱藏特定條件的字段,你可以使用屬性ATTRS像這樣:

<separator string="Description" colspan="4" attrs="{'invisible': [('show_config', '=', False)]}" /> 

否則,看不見=「1」將是不錯的使用。

謝謝。

+0

謝謝你的建議! – NeoVe 2013-04-08 07:20:42

1

position="replace"屬性將刪除任何你想從XML中刪除。

<separator string="Quotations" position="replace"/> 
<field name="purchase_ids" position="replace"/> 
+0

嗯,我試過了,但什麼都沒有發生:( – NeoVe 2013-04-08 05:11:57

+0

在我自己的答案是代碼,我不明白但它不起作用 – NeoVe 2013-04-08 05:14:37

0
<separator string="Quotations" position="replace"/> 
        <field name="purchase_ids" position="replace"> 
         <tree string="Purchase Order" position="replace"> 
          <field name="name" string="Reference"/> 
          <field name="date_order" string="Order Date"/> 
          <field name="partner_id"/> 
          <field name="company_id" groups="base.group_multi_company" widget="selection"/> 
          <field name="location_id" groups="stock.group_locations"/> 
          <field name="minimum_planned_date"/> 
          <field name="origin"/> 
          <field name="state"/> 
          <button name="purchase_cancel" states="draft,confirmed,wait_auth" string="Cancel Purchase Order" icon="gtk-cancel"/> 
          <button name="purchase_confirm" states="draft" string="Confirm Purchase Order" icon="gtk-apply"/> 
          <button name="purchase_approve" states="confirmed" string="Approved by Supplier" icon="gtk-ok"/> 
         </tree> 
        </field> 
+1

嗨,而不是改變原始源嘗試繼承相應的視圖和 – vivek 2013-04-08 06:13:43

1

其更好地添加屬性「無形」 =真不是使場看不見的。所以先找到正確的觀點,則更換分隔符,那麼無形的屬性添加到現場purchase_ids

<separator string="Quotations" position="replace"/> 
<field name="purchase_ids" position="attributes"> 
<attribute name='invisible'>1</attribute> 
</field> 
+0

噢,謝謝你,我要試一試,我只是通過在分隔符和字段中添加(不可見=「真」)來解決它,運行良好,不知道這是否是最安全的方式,但我仍然會嘗試你的解決方案,我還在學習openerp,非常感謝你! – NeoVe 2013-04-08 05:19:26

+0

不要使用替換字段,因爲有bug的變化 – OmaL 2013-04-08 05:23:22

+0

羅傑,非常感謝你 – NeoVe 2013-04-08 05:24:06