Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda

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
Buang
Jawaban Terbai

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
Buang
Penulis

thank you, working as intended

Post Terkait Replies Tampilan Aktivitas
1
Nov 24
2082
2
Agu 24
2948
2
Jan 24
978
1
Nov 23
1369
2
Okt 23
2005