跳至內容
選單
此問題已被標幟
1 回覆
2541 瀏覽次數

Would like to ask any solutions for prevent duplicates in DB to format the API call? 

頭像
捨棄
最佳答案

Use SQL constraints on model


class PosOrder(models.Model):
_inherit = "pos.order"

    _sql_constraints = [('name_uniq', 'unique (name)', "Order with this name already exists!"), ] 
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
3
4月 25
1221
1
1月 25
1895
1
8月 24
1996
2
5月 24
1565
3
5月 24
11196