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

I have a form and a notebook tree , not save the form with the empty line of notebook.

in that notebook must a field

아바타
취소
베스트 답변

Hi,

You can achieve it using python constrains. See more about constrains here: https://www.youtube.com/watch?v=50cecNF3OyQ

In your case, you can add a constrain as follows in your main model:

@api.constrains('line_ids')
def _check_lines(self):
for record in self:
if not record.line_ids:
raise ValidationError(_("Warning Message!."))


Update line_ids with your o2m field name and validation message as per your use case.

Thanks

아바타
취소