2016-12-07 74 views
0

xpath expr如何替換(隱藏)組在項目管理模塊中的標籤設置中的配置?在odoo中隱藏組9

<group string="Configuration" groups="base.group_no_one"> 
     <field name="sequence" groups="base.group_no_one"/> 
</group> 

我嘗試用下面的代碼,但得到的錯誤:

<xpath expr="//group[@string='Configuration']" position="replace"> 
</xpath> 
+0

你必須隱藏配置菜單沒有調試模式吧? –

+0

@ i'mPosSible嗨,我想隱藏這個 - > https://postimg.org/image/55wt5h5m1/我是繼承項目模塊,並在新的模塊需要隱藏這個組! –

回答

0

我猜你所得到的錯誤是ParseError,因爲你使用的是string屬性爲您的XPath表達式內選擇,這是自Odoo v9.0以來不允許的。

相反,你可以嘗試找到sequence場和選擇父:

<xpath expr="//field[@name='sequence']/.." position="replace"> 
</xpath> 

但是,更換整個部件可能不是最好的解決辦法,因爲其他模塊可以使用組或序列繼承視圖內的字段,這會導致錯誤。更好的解決方案是使用invisible屬性隱藏組。整個記錄可能看起來像這樣:

<record id="edit_project_inherit" model="ir.ui.view"> 
    <field name="model">project.project</field> 
    <field name="inherit_id" ref="project.edit_project"/> 
    <field name="arch" type="xml"> 
     <xpath expr="//field[@name='sequence']/.." position="attributes"> 
      <attribute name="invisible">1</attribute> 
     </xpath> 
    </field> 
</record>