Skip to Content
Menu
This question has been flagged
1 Reply
6454 Views

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.

Avatar
Discard
Best Answer

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.

Avatar
Discard
Related Posts Replies Views Activity
2
Jun 23
1746
1
Jun 23
1570
1
Apr 22
4233
6
Oct 15
4458
0
May 15
11647