2017-09-07 40 views
1

我與擱淺「調查」,並在OpenERP的7「鑑定」模塊中有沒有「編輯」工作中道按鈕做調查。它總是打開一份調查的新副本,即使你在半途中關閉了調查。OpenERP的7如何添加編輯/更新/保存不提交按鈕,嚮導

enter image description here

如何添加「編輯」或「編輯」 /「更新」 /「保存而不提交」在旁的OpenERP 7嚮導「完成」按鈕或「回答調查」按鈕按鈕?有沒有可能在.py文件中做?

enter image description here

回答

0

爲什麼你沒有看到在嚮導的「編輯」按鈕的原因是因爲它已經在編輯模式。這就是嚮導打開的模式,這樣用戶就不必點擊「編輯」按鈕來輸入新信息,例如在常規窗體視圖中。

一兩件事,如果我想在一個嚮導打開現有記錄我做的是創造具有type =「對象」的按鈕和名稱=「METHOD_NAME」

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

然後把它調用的方法在返回具有以下值

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

即使它不會打開最後輸入的記錄動作的Python文件。我應該怎麼做才能打開最後輸入的記錄進行編輯 –