Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
2349 มุมมอง

Hi,

How to have a unique integer (  if we wante to add the same integer it should give us an error that this integer is already exist.

(usiing odoo 10)

Regards,

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello,

You can use sql constrains for it. In your py file add:

_sql_constraints = [
('your_field_unique',
'UNIQUE(your_field)',
"Warning Message"),
]


อวตาร
ละทิ้ง
ผู้เขียน

Sorry but it didn't work

Hi medmars,

Test it in the new db, it will work fine

ผู้เขียน

Hi Niyas,

It's work perfectly when creating new database is there any method to add it on exisitng database

Thanks