Skip to Content
Menu
This question has been flagged

hello guys i want to remove sql_constraint of barcode since now i want i have product with same barcode, can someone help me? thanks :D

_sql_constraints = [

        ('barcode_uniq', 'unique(barcode)', "A barcode can only be assigned to one product !"),

    ] 

i've done do this bellow code but it raise an error for: "Fail Connect Server"

_sql_constraints = [

        ('barcode_uniq', 'Check(1=1)', "A barcode can only be assigned to one product !"),

    ]  

Avatar
Discard
Best Answer

It should work :)
make sure you inherit the same table (product.product) and check the database schema it reflects correctly and no other module added the same constraint.
ref https://github.com/odoo/odoo/blob/12.0/odoo/models.py#L2459

Avatar
Discard
Related Posts Replies Views Activity
7
Jul 19
3701
1
Aug 24
6327
0
Feb 19
2520
1
Sep 18
6733
2
Apr 24
484