Thursday, 19 October 2017

Redirect to tree view from button click

Today you will learn how to redirect to tree view from button click in odoo. In this tutorial I will create a button in xml and method for that button in py.

Xml Code:

<button name="cmd_back" type="object" class="oe_highlight" string=" Go Back "/>

py Code:

    def cmd_back(self,context=None):
        domain = [('id','in',semester_ids)]
        view_id_tree = self.env['ir.ui.view'].search(
        return {
         'type': 'ir.actions.act_window',
         # 'name': _('Product'),
         'res_model': 'obe.core.semester',
         'view_type': 'form',
         'view_mode': 'tree,form',
         'views': [(view_id_tree[0].id, 'tree'),(False,'form')],
         'view_id ref="obe_planning.semester_tree_view"': '',
         'target': 'current',
         'domain': domain,

No comments:

Post a Comment