'Draw an interpolated string using a sequence with the requested code.
If several sequences with the correct code are available to the user
(multi-company cases), the one from the user\'s current company will
be used.
:param dict context: context dictionary may contain a
``force_company`` key with the ID of the company to
use instead of the user\'s current company for the
sequence selection. A matching sequence for that
specific company will get higher priority.'

@api.model
def next_by_code(self, sequence_code):

    self.check_access_rights('read')
    company_ids = (self.env['res.company'].search([]).ids + [False])
    seq_ids = self.search(['&', ('code', '=', sequence_code), ('company_id', 'in', company_ids)])
    if (not seq_ids):
        _logger.debug(("No    ir.sequence    has    been    found    for    code    '%s'.    Please    make    sure    a    sequence    is    set    for    current    company." % sequence_code))
        return False
    force_company = self._context.get('force_company')
    if (not force_company):
        force_company = self.env.user.company_id.id
    preferred_sequences = [s for s in seq_ids if (s.company_id and (s.company_id.id == force_company))]
    seq_id = (preferred_sequences[0] if preferred_sequences else seq_ids[0])
    return seq_id._next()
