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

Hi,


if I call model.browse('234') although there isn't any record with id '234', the result responds to ensure_one() and len. The only way to raise an exception is to call name attribute.

What is the best way to ensure browse returns an existing record?


Thanks

아바타
취소
베스트 답변

if record.exists():
# record existed
https://github.com/odoo/odoo/blob/12.0/odoo/models.py#L4316

아바타
취소