跳至內容
選單
此問題已被標幟
1 回覆
7298 瀏覽次數

I want to open view by using the js file, 

code: 

res = self.pool['ir.model.data'].get_object_reference(cr, uid, 'my_module', 'my_view_id')

return {

'view_type': 'form',

'view_mode': 'form',

'view_id': res[1],

'res_model': '',

'type': 'ir.actions.act_window',

'target': 'current',

}


I created python function which returns the view, but as I am returning the view it is return to the JS and not opening the view. So, I want to know that how to open this view from the JS. As some tree view are opening in POS using JS but I am not getting how to open Graph view or Form View.

頭像
捨棄
最佳答案

Hello Khatri,

You can call action from js by this way..

return this.do_action({

     type: 'ir.actions.act_window',

     name: this.string,

     res_model: this.field.relation,

     views: this.options.views,

     target: 'current',

     context: context,

     domain: domain,

});

But you have created function that return action in python. as you said that function not work properly. So would like to suggest first try to use @api.multi in python function.


Hope this helps.

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
6月 23
2730
1
6月 23
2524
1
4月 22
5174
6
10月 15
5397
0
5月 15
12603