Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odpovědi
9180 Zobrazení

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

How to acheive this

Avatar
Zrušit
Nejlepší odpověď

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
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit

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

it will help you..

Related Posts Odpovědi Zobrazení Aktivita
1
pro 24
6077
3
srp 24
6923
4
čvc 24
41239
5
dub 23
99028
3
lis 22
4344