Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
2075 Представления

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

Аватар
Отменить
Лучший ответ

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

Аватар
Отменить
Автор

thank you, working as intended

Related Posts Ответы Просмотры Активность
1
нояб. 24
2843
2
авг. 24
4129
2
янв. 24
2025
1
нояб. 23
2206
2
окт. 23
2329