Reputation: 1072
I have an inherited module and I am trying to return
view_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'product', 'product_product_tree_view')
view_id = view_ref and view_ref[1] or False
return {
'type': 'ir.actions.act_window',
'name': 'Draft Product',
'res_model': 'product.product',
'view_type': 'form',
'view_id': view_id,
'view_mode': 'tree',
'target': 'current',
'nodestroy': True,
}
at the end of product inherited write method. But it throws an error
TypeError: this.views_src[0] is undefined
I am fed up doing this for a long time.. any help or workaround is appreciated.... I actually want after editing the form view to be returned to tree view.
Thanks in advance..
Upvotes: 1
Views: 1123
Reputation: 26768
Specify views
key to solve the problem.
To open the list view of products:
{
"type": "ir.actions.act_window",
"res_model": "product.product",
"views": [[False, "list"]],
"target": "current",
}
Upvotes: 1
Reputation: 767
The following code is an example of how to return a tree view:
return {
'name':_("Name desired"),
'view_mode': 'tree',
'view_id': False,
'view_type': 'tree',
'res_model': 'your model',
'res_id': read_ids, \\\instead of read_ids, you must pass the desired record ids\\\
'type': 'ir.actions.act_window',
'nodestroy': True,
'target': 'new',
'domain': "[('id','in',%s)]" %(read_ids),
'context': context
}
I hope this solves your problem.
Thanks And Regards
Upvotes: 1