Impacted versions: 10.0/11.0

Steps to reproduce: go to [http://281537-11-0-12c7d3.runbot8.odoo.com](http://281537-11-0-12c7d3.runbot8.odoo.com/web?debug=1?#id=12&view_type=form&model=ir.sequence&menu_id=38&action=22) --> Settings --> Sequences --> 'Account reconcile sequence'

Current behavior: Traceback during Saving record

![](https://image.prntscr.com/image/G4x_oq6xQr2HduZQiUPDdA.png)

Change Implementation to Standard and Save the record.

![](https://image.prntscr.com/image/cv0b3Pq9SzW0Dya-zZ4cyA.png)
Expected behavior: Should Save the record

Video/Screenshot link (optional): 


openerp/addons/base/ir/ir_sequence.py
return  
        
        
        
        
        
        self.env.cr.execute("""
            SELECT indexname FROM pg_indexes WHERE indexname =
            'ir_sequence_unique_code_company_id_idx'""")
        if not self.env.cr.fetchone():
            self.env.cr.execute("""
                CREATE UNIQUE INDEX ir_sequence_unique_code_company_id_idx
                ON ir_sequence (code, (COALESCE(company_id,-1)))""")
    @api.model
    def create(self, values):
        """ Create a sequence, in implementation == standard a fast gaps-allowed PostgreSQL sequence is used.
        """
        seq = super(ir_sequence, self).create(values)
        if values.get('implementation', 'standard') == 'standard':
            _create_sequence(self.env.cr, "ir_sequence_%03d" % seq.id, values.get('number_increment', 1), values.get('number_next', 1))
        return seq
    @api.multi
    def unlink(self):
        _drop_sequence(self.env.cr, ["ir_sequence_%03d" % x.id for x in self])
        return super(ir_sequence, self).unlink()
    @api.multi
    def write(self, values):