Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2082 Lượt xem

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?​

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

thank you, working as intended

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 24
2853
2
thg 8 24
4136
2
thg 1 24
2031
1
thg 11 23
2210
2
thg 10 23
2336