0

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.

Jeenit khatri
  • 318
  • 4
  • 19

1 Answers1

0

You can call action from js by this way..

return this.do_action({
   type: 'ir.actions.act_window',
   name: 'action_name',
   res_model: model,
   views: views: [[form_id, 'form'], [graph_id, 'graph']],
   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.

  • The code is already in working format.... But when opens view its triggers the error NS_ERROR_FAILURE: – Jeenit khatri Jul 18 '16 at 05:45
  • And also the default functionality of Odoo will not working after opening the view... that no js call and no load of data from the view generated.... It just load the view. – Jeenit khatri Jul 18 '16 at 06:11