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

Hi,

I added a compute field and do the calculation in function through when quantity is 0 or less than 0 popup error message. but when I go back trying to open form view I can't open the because error message comes.

I need to know is there any possibility to pop up an error message when I used to compute field.




아바타
취소
베스트 답변

Hi Dishan,


Try to write an onchange function instead. So the function will only trigger when the value in your field is changed. Also make sure you add a check to not show the error when there is no value in the field.


@api.onchange('value')
def _onchange_value(self):
if self.value:
if self.value <= 0:
raise UserError("Error")
          
아바타
취소

How can this be done in the front end while creating a custom field

관련 게시물 답글 화면 활동
2
2월 24
15886
1
12월 22
5205
2
12월 22
14777
2
6월 22
6715
2
6월 22
4960