Skip to Content
Menu
This question has been flagged
2 Replies
5617 Views

Hi everyone,

I have wizard in that if i click confirm button data should be saved and it has to able to open the tree view of different table.

<button name="test_dialog" string="Confirm" type="object" class="oe_highlight"/>


@api.multi
    def test_dialog(self):
        view2 = self.env.ref('asset_management.asset_view_tree')
        res = self.env['assets.creation'].search([])
        for record in res:
            record.hide_button = True

        return {
            "name": _("Asset Assignment Data Confirmation"),
            'tag': 'show_my_dialog', 
            "view_mode": "tree",
            'view_id': view2.id,
            'view_type': 'tree',
            "res_model": 'assets.creation',
            "type": 'ir.actions.act_window',
            "target": "current",
        }


anyone can u help me with this?



Avatar
Discard

Hi,

i got ans.

@api.multi

def test_dialog(self):

res = self.env['assets.creation'].search([])

for record in res:

record.hide_button = True

return {

"name": _("Asset Details Confirmation"),

'tag': 'show_my_dialog',

'view_mode': 'tree,form',

'view_type': 'form',

"res_model": 'assets.creation',

"type": 'ir.actions.act_window',

"target": "current",

}

Thanks

Best Answer

Hi,

On clicking the button you can open a view by returning like this,

tree_view_id = self.env.ref('hr.view_employee_tree').ids
form_view_id = self.env.ref('hr.view_employee_form').ids
return {
'name': 'Test',
'view_mode': 'tree',
'views': [[tree_view_id, 'tree'], [form_view_id, 'form']],
'res_model': 'hr.employee',
'type': 'ir.actions.act_window',
'target': 'current',
}

Thanks

Avatar
Discard
Author

Thanku