2017-03-23 1 views
0

私はフォームビューを継承し、xpathを使用していくつかの変更を加えました。管理者だけに表示するために、フォームビューのヘッダーにボタンが必要です。私はグループを入れているときには、その寄付は、次のエラー:特定のユーザ(管理者)のボタンを表示中にエラーが発生しましたodo 8

エラーの詳細:

error_details

私のコードは次のとおりです。

<record id="wms_stock_view_move_form" model="ir.ui.view"> 
     <field name="name">wms.stock.view.move.form</field> 
     <field name="model">stock.move</field> 
     <field name="inherit_id" ref="stock.view_move_form" /> 
     <field name="arch" type="xml"> 
      <field name="location_id" position="attributes"> 
       <attribute name="domain">[('name','!=', 'Scrapped')]</attribute> 
      </field> 
      <field name="location_dest_id" position="attributes"> 
       <attribute name="domain">[('name','!=', 'Scrapped')]</attribute> 
      </field> 
      <xpath expr='//form[@string="Stock Moves"]' position='attributes'> 
       <attribute name="create">false</attribute> 
       <attribute name="edit">false</attribute> 
       <attribute name="delete">false</attribute> 
      </xpath> 
      <xpath expr='//button[@name="action_cancel"]' position='attributes'> 
       <attribute name="invisible">True</attribute> 
      </xpath> 
      <button name="action_done" states="draft,assigned,confirmed" string="Process Entirely" type="object" class="oe_highlight" position="replace" groups="base.group_no_one"/> 
     </field> 
</record> 

答えて

0

は私が最終的に自分の質問を解決し、解決策次のとおりです:

<xpath expr='//button[@name="action_done"]' position='replace'> 
       <button name="action_done" states="draft,assigned,confirmed" string="Process Entirely" type="object" class="oe_highlight" position="replace" groups="base.group_no_one"/> 
</xpath> 
+0

前のコードでは、管理者グループを追加しました。しかしここでカスタムグループを追加しましたか? –

+0

はい、それは私のタイプミスでした。私は今修正しました:) – odoobeginner

+0

他の(拡張子)ビューの変更が失われる可能性があるため、ボタン全体を置き換えることはありません。 – CZoellner

0

私はどちらのボタンを推測する必要がありますあなたのエラーはaction_doneに関係していますが、あなたの答えはaction_cancelですから、新しいグループを設定してください。だから私はこれを抽象的にやってみましょう。あなたはすでにあなたの質問に答えがあります。 XPathを使用してボタンを見つけて使用するposition="attributes"

<xpath expr="//button[@name='button_name']" position="attributes"> 
    <attribute name="groups">module_name.group_id</attribute> 
</xpath> 
+0

実際に私は2つのボタン、action_cancelとaction_doneを持っていました。 action_doneを質問に入れ、action_cancelを答えに入れたのは私の間違いでした。私は今私の答えを編集しています。指摘してくれてありがとう。 – odoobeginner

関連する問題