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


@onchange has self._origin to get previous values, but this is not available for @constrains.

How do you get the previous value of a field? This is most usefull sometimes when you want to add a constrain based on a previous value


Right now I'm solving this in the write() method by getting the value before and after calling super.write and then raising an UserError. Seems this would be better fit for constrains


Thanks



아바타
취소
베스트 답변

I go further and asks how to know if it is a newly created record from inside constrains decorator method?

아바타
취소
관련 게시물 답글 화면 활동
@api.constrains 해결 완료
2
12월 23
3505
0
6월 21
2782
2
6월 20
3332
2
3월 24
5832
1
7월 23
1791