I have a module that overrides the default write functionality for sales orders. This works fine, but after the write I would like to return to the tree view of sales orders instead of the form view which is the default functionality.
The following code is what I'm working with at the moment, i.e. I'm trying to pass the treeview information inside the result object. There are no error messages, but the user is still always returned to the form view. Any suggestions? Thanks!
class Sales_order(osv.Model):
_inherit = 'sale.order'
def write(self, cr, uid, ids, vals, context=None):
# own custom code goes here - works OK
# ...
# call write - works OK
super(Sales_order, self).write(cr, uid, ids, vals, context)
# After all done, how to return to the tree view?
models_data = self.pool.get('ir.model.data')
sale_order_tree = models_data._get_id(cr, uid, 'sale', 'view_order_tree')
return {
'name': 'Quotations',
'view_type': 'tree',
"view_mode": 'tree,form',
'res_model': 'sale.order',
'type': 'ir.actions.act_window',
'search_view_id': sale_order_tree,
}
I have the same requirement.Any one please help :(
Hi, Please have a look on answer and if it is ok then mark it as answer.