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

Show message on creating there is similar contact in odoo

아바타
취소
베스트 답변

Hi,

If you need to do this from code side, you can add a constrain and check for existing records and then raise a validation error if existing matches found.

You can achieve it by adding the below code in the corresponding model:

@api.constrains('email')
def _check_email_uniqueness(self):
for partner in self:
if partner.email:
existing_partner = self.env['res.partner'].search([
('email', '=', partner.email),
('id', '!=', partner.id)
])
if existing_partner:
raise UserError('Email already exists!')

If you need to achieve it from user interface, you can achieve it using, automated action.

See a similar example depicted here: Prevent Product Duplication without code using automated actions

Thanks

아바타
취소
관련 게시물 답글 화면 활동
2
8월 25
2514
1
7월 25
948
1
8월 25
1151
0
5월 25
1393
2
4월 25
3589