Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
1640 Zobrazení

I want to open a user form view of a specific user.

user = self.env['res.user'].search([], limit=1)
return {
'type': 'ir.actions.act_window',
'name': 'res.users.form',
'res_model': 'res.users',
'res_id': user.id,
'view_type': 'form',
'view_mode': 'form,tree',
'target': 'current',
'context': {'no_breadcrumbs': True},
}

The above code opens res.users.simplified.form instead of res.users.form


How do i open the res.users.form view instead of the simplified version?​

Avatar
Zrušit
Nejlepší odpověď

Hi,

To open a specific user form you need to define the id of the user which you need to open,

user = self.env['res.users'].search([], limit=1)

#Here you want to mention the ID of the form view you want to open

form_view_id = self.env.ref('your_module_name.view_id_of_your_form_view').id

return {

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

    'name': 'User Form',

    'res_model': 'res.users',

    'res_id': user.id,

    'view_mode': 'form',

    'view_id': form_view_id,  # Specify the ID of the form view

    'target': 'current',

    'context': {'no_breadcrumbs': True},

}


Hope it helps

Avatar
Zrušit
Autor

thank you, working as intended

Related Posts Odpovědi Zobrazení Aktivita
1
lis 24
2267
2
srp 24
3172
2
led 24
1160
1
lis 23
1562
2
říj 23
2084