'Returns the next number in the preferred sequence in all the ones given in self.'

def _next(self):

    if (not self.use_date_range):
        return self._next_do()
    dt = fields.Date.today()
    if self._context.get('ir_sequence_date'):
        dt = self._context.get('ir_sequence_date')
    seq_date = self.env['ir.sequence.date_range'].search([('sequence_id', '=', self.id), ('date_from', '<=', dt), ('date_to', '>=', dt)], limit=1)
    if (not seq_date):
        seq_date = self._create_date_range_seq(dt)
    return seq_date.with_context(ir_sequence_date_range=seq_date.date_from)._next()
