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

In my case i change all the fields to readonly when product moved to done state. So, the user will  make change in the product in done state, if he in product master group. But, i don't know to enable edit for this specific group.

THANK YOU

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

Hi,

If you need to make this form editable for a group of users, create inherited view and set the user group for the view, so that the changes applied in this inherited view will only apply to users in this group.

See this example: https://www.youtube.com/watch?v=Fsp6lAPHz08

Thanks

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

Hi,

So you need to make fields editable when the state is 'done' and if the user is in product master group.

declare a boolean field like below in your model, for checking whether the current logged user belongs to  product master group or not.

is_master_user = fields.Boolean(compute='_compute_is_master_user')

def _compute_is_master_user(self):
for record in self:
if record.has_group('external id of your product master group'):
record.is_master_user = True
else
:
record.is_master_user = False

Then you can give the readonly condition to the required fields like below.

<field name="your_field" attrs="{'readonly': [('state', '=', 'done), ('is_master_user', '=', False)]}"/>


Hope it helps

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
أكتوبر 25
2716
1
سبتمبر 25
2731
3
يوليو 25
4115
1
مايو 25
2206
4
مايو 25
3564