콘텐츠로 건너뛰기
메뉴
신고된 질문입니다
2 답글
3054 화면

I need a new field in res.partner for account number. The number should only belong to one contact and must be created manually (no sequencing). How do we get a uniqueness check on that field to prevent duplicate entries and warn the user that the value already exists?

아바타
취소
베스트 답변

Hello, would you by any chance know the python code to use ?

Thanks a lot.

아바타
취소

Hi,

You can use sql constraints.
_sql_constraints = [('name_uniq', "unique(name, applicability, country_id)", "A tag with the same name and applicability already exists in this country.")]

베스트 답변

Hi,

You can create an automated action in the database, that is getting triggered on writing or creating record in this model and you can raise warning if duplicates are found.


Check whether base_automation module is installed in the database, if not install it, then keeping the developer mode activated, navigate to Automated Actions menu under the settings and create a new record here, select triggered on Create & Update and execute a python code, that check and raises the warning.

Thanks

아바타
취소
관련 게시물 답글 화면 활동
1
2월 22
3616
1
12월 24
2550
0
12월 21
2199
4
3월 15
11869
2
8월 24
9609