Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
7453 Переглядів

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.

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
черв. 23
2896
1
черв. 23
2688
1
квіт. 22
5335
6
жовт. 15
5510
0
трав. 15
12808