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

Hi,


in our application we have different user groups. We have users that are "teachers" and users that are "students". A student should only see specific fields in a view (e.g. contact) whereas a teacher should see all fields.


Hiding those fields in the view only hides them in the generated HTML and if you are capable of manipulating the CSS you are able to "un-hide" them and access fields that you're not allowed to see.


What is the "way to go" to not only hide those fields but really block "students" from accessing "teacher-only" fields in a view?


Thanks in advance!


Context: we are running Odoo in community edition on our own server.

الصورة الرمزية
إهمال
أفضل إجابة


الصورة الرمزية
إهمال
أفضل إجابة

To control field visibility for different user types in Odoo, you can define user groups. This allows you to make certain fields visible only to specific users based on their group membership, while keeping them hidden from others.

For example, to make the company_id field visible only to users who belong to the Multi-Company group (group_multi_company), you would set the groups attribute on that field.

<field name="company_id" groups="base.group_multi_company"/>
الصورة الرمزية
إهمال
أفضل إجابة

Yes, For that you can use group access rights to hide from non-accessible group users.

الصورة الرمزية
إهمال
أفضل إجابة

You know access rights only work on models and not fields.
So if you have many2one field, and many2many field, and one2many field, you can set access rights to not see that models used in many2one, many2many, one2many field but if you have char, float, date, ... fields, you can use only groups in fields. 

الصورة الرمزية
إهمال
أفضل إجابة






الصورة الرمزية
إهمال

<form>
<group>
<field name="contact"/>
<field name="teacher_field" groups="your_module.teacher_group"/>
</group>
</form>

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مارس 24
1432
5
يونيو 25
14194
0
ديسمبر 23
17
1
يونيو 25
1175
3
يوليو 25
2908