2016-04-17 4 views
1

財務終了状態の別のモジュールに存在するステータス選択フィールドに基づいて、account.invoiceの「検証」ボタンを非表示にする必要があります。別のモジュールの状態に基づいてaccount.invoiceのValidateボタンを非表示にするにはどうすればいいですか?

隠す検証ボタンステータスがfinancial_close

<button name="invoice_open" states="draft" string="Validate" class="oe_highlight" groups="base.group_user"/> 

であれば、金融近い状態に

'status': fields.selection([ 
      ('open', 'Open'), 
      ('operation_close', 'Operation Closed'), 
      ('financial_close', 'Financial Closed'), 
      ('cancel', 'Cancel'), 
     ], string="Status"), 

答えて

2

が含まれている別のモジュールは、これらのステップFollw:

  1. 別でaccount.invoiceMany2oneを作成します。モジュール
  2. mystatusaccount.invoiceに、Many2oneを事前に作成してください。
  3. 親ビュー[invoice_form]がのinvoice_openで継承されています。
  4. 関連フィールドをmystatusのように表示してください。<field name="mystatus"/>
  5. ここで使用xpathpostion= attributes

は、コードスニペットです:

<xpath expr="//button[@name='invoice_open']" position="attributes"> 
<attribute name="attrs">{'invisible':[('mystatus','=', 'open')]}</attribute> 

これはあなたのケース

+0

にinvoice_openためのボタンの定義は、状態属性を使用して助けるかもしれません。したがって、あなたが気を付けて、それを上書きする必要があるかどうかを判断する必要があります。 Odooは州とattrsを組み合わせます。 – CZoellner

関連する問題