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

 I have created one field in my module and i dont want other user write ,create and edit .

How to acheive this

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

Try like this it may help you,
Add an extra field in the view, ie,

in Xml,

<field name="check_field" invisible="1" />
<field name="new_field" attrs="{'readonly': [('check_field', '!=', True)]}" />

in py,
check_field = fields.Boolean('Check', compute='get_user')


@api.multi  

@api.depends('new_field')   

def get_user(self):
        if SUPERUSER_ID == self._uid:
            self.check_user = True    

       else:
            self.check_user = False





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

Write two views for this model.One for the administrative user and other for the read only group.

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

Find administrative id from res_users model, after
<field name="name_field" attrs="{'readonly': [('<user_id>', '!=', <administrative id>)]}" />

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

<field name="name_field" attrs="{'readonly': [('<user_id>', '!=', 1)]}" />

it will help you..

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
ديسمبر 24
6077
3
أغسطس 24
6925
4
يوليو 24
41240
5
أبريل 23
99032
3
نوفمبر 22
4345