2012-04-19 54 views
2

我正在構建一個openerp客戶模塊,在樹形視圖中,每個條目都有一個按鈕,按下時,會觸發act_window動作並打開新的彈出窗口-up窗口,但同時,主要的gtk客戶端消失了(只剩下彈出窗口)。此外,我已將「目標」設置爲「新」,但仍然相同。有任何想法嗎?Openerp act_window彈出一個新窗口,但主客戶端消失

客戶端:在Windows GTK-6.0.3

服務器:6.0.2 Debian的2.6.32

的XML是什麼樣子:

<field name="type">tree</field> 
<field name="arch" type="xml"> 
    <tree string="Field Schema"> 
     <field name="field_name" /> 
     <field name="field_type" /> 
     <button name="edit" type="object" string="View and Edit" icon="gtk-go-forward" /> 
    </tree> 
</field> 

和編輯功能觸發長相像:

def edit(self, cr, uid, ids, context=None): 
    obj_name = some_fn_dynamic_get_obj_name_from_ids(ids) 
    obj = self.pool.get(obj_name) 
    if not obj: 
     raise osv.except_osv('not supported') 
    res_id = obj.create(....) 
    ... 
    return { 
     'type': 'ir.actions.act_window', 
     'name': 'View and Edit', 
     'view_mode': 'form', 
     'view_type': 'form', 
     'res_model': obj_name, 
     'res_id': res_id, 
     'target': 'new', 
     'context': context, 
    } 

更新:調試到客戶端的源後,我終於發現:我做了一個錯字:nodestory在正確的應該是nodestroy

return { 
     'type': 'ir.actions.act_window', 
     ... 
     'context': context, 
     'nodestroy': True, 
    } 

T_T

回答

0

我看不出什麼明顯的錯誤。在developer book中討論了target屬性。我可以建議的唯一的事情是在源代碼中查找使用target屬性的示例,並查看它們與您的不同之處。

+0

我已經簽了幾個插件源,但沒有發現任何差異。我也測試過了gtk-client-6.1-win **和** web-6.0.3-client **,gtk客戶端總是有同樣的問題。但Web客戶端是好的。 – jayven 2012-04-20 03:22:40

+0

其他插件是否與您的代碼有相同的問題?如果沒有,你可以做一些舊技巧來慢慢消除兩組代碼之間的所有差異。這很慢,但很有效。 – 2012-04-20 05:21:17

0

要停止客戶端消失,你需要添加: 「nodestroy」:的確,