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

I have written a custom field for the res.users model, when the user enters the content and clicks save for this field, the error message is displayed

"You are not allowed to modify 'User' (res.users) records.


This operation is allowed for the following groups:

- Administration/Access Rights


Contact your administrator to request access if necessary."


But when entering values ​​for fields such as email, work email, Work Mobile and clicking save, the error message is not displayed

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

good

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

the res.users model has specific security restrictions to prevent unauthorized changes to user records. Certain fields, like emails and phone numbers, may be editable by default for users with fewer permissions, but adding a custom field can cause permission issues because it doesn't fall under the predefined access rules for these fields.

To allow users with limited permissions to update your custom field on the res.users model without encountering the error, you can add an access rule for that field or adjust the write permissions for the res.users model through a few different methods.

Add sudo() for Field Updates: If only users with higher access should modify the custom field, you can override the write method on res.users and use sudo() to elevate privileges when saving the custom field also you can use Custom Write Method to Handle Permissionsand  Override the write method and allow specific updates based on field names.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
يوليو 24
837
1
يوليو 24
583
1
أغسطس 24
1019
2
يناير 25
475
0
يونيو 24
800