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

Hi,




I'd like to know how can I disable the edit button in form when a boolean field is set to be true, It could be done too by just raising an error every moment the record is tried to be modified after having the boolean to true too. I'm in odoo.sh and I'd like to know how could I do this through automated actions using studio or any other way possible.

아바타
취소
베스트 답변

I believe it will be hard to hide that button but you could raise the message with a computed boolean field that depends on your field of interest , if you would like that the edition depends on a condition you could use for example

for record in self:

    if record.value == '2':

        record.boolean = True

    elif record.value == 'value to avoid edition':}

        raise Warning ('You cannot edit that value')  

  else:

     record.boolean = False      


If that is not the case, you could use a lock field and a blocked computed field with inverse computation

for record in self:
        if record.locked and record.blocked:
            raise ValidationError("You cannot edit")

               else:

                    record.blocked = False

                     record.blocked = True


아바타
취소
작성자

What do you mean by record.value== '2'?

작성자

How are you pointing this to the edit button in the form view?

It was just a condition if you needed to, actually let me update a little the answer

관련 게시물 답글 화면 활동
0
10월 21
30
2
1월 25
3812
2
10월 24
3094
0
2월 22
157
1
9월 21
2618