# -*- coding: utf-8 -*-
# © <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import _, models


class ProductProduct(models.Model):
    _inherit = 'product.product'

    _sql_constraints = [
        ('default_uniq', 'unique (default_code)',
         _('The field Internal Reference must be unique!'))
    ]

@@ -139,16 +139,21 @@
 t _,
+ api,
  models%0A
 %0A%0Acl
@@ -148,16 +148,63 @@
  models%0A
+from openerp.exceptions import ValidationError%0A
 %0A%0Aclass 
@@ -270,16 +270,436 @@
 ct'%0A%0A   
+ @api.one%0A    @api.constrains('default_code')%0A    def _check_default_code(self):%0A        product = self.env%5B'product.product'%5D.search(%0A            %5B('default_code', '=', self.default_code),%0A             ('active', '=', True),%0A             ('id', '!=', self.id)%5D) or False%0A        if product:%0A            raise ValidationError(_(%22The field Internal Reference must be%22%0A                                  %22 unique!%22))%0A%0A    #
  _sql_co
@@ -711,24 +711,26 @@
 ints = %5B%0A   
+ #
      ('defau
@@ -763,24 +763,26 @@
 _code)',%0A   
+ #
       _('The
@@ -825,15 +825,19 @@
 ique!'))
+,%0A
 %0A   
+ #
  %5D%0A

add constrains for default.code