Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
3 Risposte
9429 Visualizzazioni

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

How to acheive this

Avatar
Abbandona
Risposta migliore

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





Avatar
Abbandona
Risposta migliore

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

Avatar
Abbandona
Risposta migliore

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

Avatar
Abbandona

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

it will help you..

Post correlati Risposte Visualizzazioni Attività
1
dic 24
6564
3
ago 24
7351
4
lug 24
42000
5
apr 23
100218
3
nov 22
4829