old_contents: # -*- encoding: utf-8 -*-
  # #############################################################################
  #
  # OpenERP, Open Source Management Solution
  # This module copyright (C) 2010 - 2014 Savoir-faire Linux
  # (<http://www.savoirfairelinux.com>).
  #
  #    This program is free software: you can redistribute it and/or modify
  #    it under the terms of the GNU Affero General Public License as
  #    published by the Free Software Foundation, either version 3 of the
  #    License, or (at your option) any later version.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  #    GNU Affero General Public License for more details.
  #
  #    You should have received a copy of the GNU Affero General Public License
  #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  #
  ##############################################################################
  
  from openerp.osv import orm
  from openerp.tools.translate import _
  
  
  class account_invoice(orm.Model):
      _inherit = "account.invoice"
  
      def _check_unique_supplier_invoice_number_insensitive(self, cr, uid, ids,
                                                            context=None):
          sr_ids = self.search(cr, uid, [], context=context)
          lst = [
              x.supplier_invoice_number.lower() for x in
              self.browse(cr, uid, sr_ids, context=context)
              if x.supplier_invoice_number and x.id not in ids
          ]
          for self_obj in self.browse(cr, uid, ids, context=context):
              if self_obj.supplier_invoice_number \
                      and self_obj.supplier_invoice_number.lower() in lst:
                  return False
          return True
  
      msg = _(
          'The supplier invoice number must be unique for each client order !')
      _constraints = [
          (_check_unique_supplier_invoice_number_insensitive, msg,
           ['supplier_invoice_number'])]
  
new_contents: # -*- encoding: utf-8 -*-
  # #############################################################################
  #
  # OpenERP, Open Source Management Solution
  # This module copyright (C) 2010 - 2014 Savoir-faire Linux
  # (<http://www.savoirfairelinux.com>).
  #
  #    This program is free software: you can redistribute it and/or modify
  #    it under the terms of the GNU Affero General Public License as
  #    published by the Free Software Foundation, either version 3 of the
  #    License, or (at your option) any later version.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  #    GNU Affero General Public License for more details.
  #
  #    You should have received a copy of the GNU Affero General Public License
  #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  #
  ##############################################################################
  
  from openerp.osv import orm
  from openerp.tools.translate import _
  
  
  class account_invoice(orm.Model):
      _inherit = "account.invoice"
  
      def copy(self, cr, uid, id, default=None, context=None):
          default = default or {}
          default.update({
              'supplier_invoice_number': '',
          })
          return super(account_invoice, self).copy(cr, uid, id, default, context)
  
      def _check_unique_supplier_invoice_number_insensitive(self, cr, uid, ids,
                                                            context=None):
          sr_ids = self.search(cr, uid, [], context=context)
          lst = [
              x.supplier_invoice_number.lower() for x in
              self.browse(cr, uid, sr_ids, context=context)
              if x.supplier_invoice_number and x.id not in ids
          ]
          for self_obj in self.browse(cr, uid, ids, context=context):
              if self_obj.supplier_invoice_number \
                      and self_obj.supplier_invoice_number.lower() in lst:
                  return False
          return True
  
      msg = _(
          'The supplier invoice number must be unique for each client order !')
      _constraints = [
          (_check_unique_supplier_invoice_number_insensitive, msg,
           ['supplier_invoice_number'])]
  
subject: fix duplicate -remove field supplier_invoice_number.