Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
9426 Widoki

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

How to acheive this

Awatar
Odrzuć
Najlepsza odpowiedź

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





Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć

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

it will help you..

Powiązane posty Odpowiedzi Widoki Czynność
1
gru 24
6563
3
sie 24
7349
4
lip 24
41993
5
kwi 23
100209
3
lis 22
4826