콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
9221 화면

 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
6120
3
8월 24
6976
4
7월 24
41310
5
4월 23
99136
3
11월 22
4387