コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3 返信
9181 ビュー

 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
12月 24
6077
3
8月 24
6923
4
7月 24
41239
5
4月 23
99028
3
11月 22
4344