I need to create a module in Odoov8 that can make ean13 field in product.template unique.
Here's my code:
# -*- coding: utf-8 -*-
from openerp import models, fields, api, _
from openerp.exceptions import ValidationError
class uniq_barcode(models.Model):
inherit = "product.template"
ean13 = fields.Char()
_sql_constraints = [
('ean13_uniq', 'unique(ean13)', _('code bare exisite deja !')),
]
But it's not working! I'm working on this since yesterday