Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
3 Ответы
9191 Представления

 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..

Related Posts Ответы Просмотры Активность
1
дек. 24
6083
3
авг. 24
6929
4
июл. 24
41250
5
апр. 23
99047
3
нояб. 22
4349