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

The old API defined a unique field as follows:

_sql_constraints = [
('cne_unique', 'unique(cne)', 'cne already exists!')
]

The new API deprecates this, and recommends to use @api.constrains, but how can I code to check for uniqueness in an efficient way?














아바타
취소
베스트 답변

Hi

this is _constraints which is deprecated (python constraint), not _sql_constraints, see :


https://www.odoo.com/documentation/8.0/reference/orm.html

아바타
취소
작성자 베스트 답변

@Cyril: please read my question. I know it is deprecated, I need to know how to do this in v8. 

아바타
취소

please read my answer and verify in link I gave, _constraints and and _sql_constraints are two different things, you talk about _sql_constraints and this is not deprecated, see after => copy/paste v8 doc (link I gave) : _constraints list of (constraint_function, message, fields) defining Python constraints. The fields list is indicative Deprecated since version 8.0: use constrains() _sql_constraints list of (name, sql_definition, message) triples defining SQL constraints to execute when generating the backing table

작성자

Cyril, I sincerely apologize. You were completely right. _sql_constraints is not deprecated. I just don't know how to read. Thanks.

Now you have your answer ^^, bye

관련 게시물 답글 화면 활동
1
11월 22
3459
0
6월 21
6044
0
3월 21
2852
2
1월 20
21836
2
5월 18
4156