تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
2074 أدوات العرض

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

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
نوفمبر 24
2843
2
أغسطس 24
4129
2
يناير 24
2025
1
نوفمبر 23
2206
2
أكتوبر 23
2329