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

I want the status record to be uneditable if state = active, done

아바타
취소
베스트 답변

Hi,

In Odoo 17, to make a field (like status) read-only when the record’s state is either "active" or "done" You can achieve this using the 'readonly' attribute in the XML view, or by using Python logic with @api.depends and readonly=True on the field.


XML


<field name="status" readonly="state in ['active', 'done']"/>


Hope it helps

아바타
취소
베스트 답변

is this you need for particular users or all users  ( not to edit record - only view)

아바타
취소
작성자 베스트 답변

i want to all fields in record to be uneditable

아바타
취소
베스트 답변

Use the following code in your XML:

field name="state" readonly="state in ['active', 'done']"

아바타
취소
관련 게시물 답글 화면 활동
0
8월 25
144
1
8월 25
572
1
8월 25
486
4
7월 25
1820
1
7월 25
1037