2017-09-07 8 views
1

私はOpenerp 7の "Survey"と "Appraisal"モジュールを孤立させて作業しています。 "Edit"調査。調査の途中で調査を閉じても、常に新しい調査のコピーが開きます。 「編集」を追加する方法Openerp 7ウィザードに送信ボタンなしで編集/更新/保存を追加する方法

enter image description here

または「編集」/「更新」/ボタンまたはOpenerp 7ウィザードのボタン「調査回答」「完了」の横のボタンを「なし保存提出しますか」? .pyファイルで行うことは可能ですか?

enter image description here

答えて

0

ウィザードの「編集」ボタンを参照してくださいいけない理由は、そのすでに編集モードです。これは、ウィザードが開くモードで、ユーザーは通常のフォームビューのように新しい情報を入力するために「編集」ボタンをクリックする必要がありません。

私は、ウィザードで既存のレコードを開きたい場合は、私がやることの一つは、タイプ=「オブジェクト」と名=「METHOD_NAME」

<!-- In your xml file --> 
<button type="object" name="method_name" string="Button" context="{'optional': 'values'}" /> 

でボタンを作成することです、それはメソッドを呼び出しています次の値を持つアクションを返すPythonファイルで最後に入力したレコードが開かないにもかかわらず、

def method_name(self, cr, uid, ids, context=None): 
    # make sure to send the record id you want to open 
    # it could be passed in the context, or other variable 
    # i'm only using the context in this example 
    if context == None: 
     context = {} 

    # if the rec_int_id is False, then the wizard will try to make a new record. Otherwise, it opens the the wizard with existing data 
    rec_int_id = context.get('record_id',False) 

    view_id = self.pool.get('ir.ui.view').search(cr, uid, [('name','=','your name of view')]) 

    # search functions always returns a list, so get the 1st element if found 
    if view_id: 
     view_id = view_id[0] 

     return { 
      'type': 'ir.actions.act_window', 
      'view_type': 'form', 
      'view_mode': 'form', 
      'res_model': 'your.model.name', 
      'res_id': rec_int_id, # integer id of the record to open 
      'view_id': view_id, # integer view id 
      'target': 'new', # opens the view as a wizard 
      'context': context, 
      'name': 'Any name you want to give' 
     } 

    else: 
     raise osv.except_osv('','View not found...') 
+0

が返されます。編集するために最後に入力したレコードを開くようにするにはどうすればよいですか? –

関連する問題