Context manager to switch current company.

    Accepts both company record and xmlid.

def switch_company(ctx, company):
    """Context manager to switch current company.

    Accepts both company record and xmlid.
    """
    current_company = ctx.env.user.company_id
    ctx.env.user.company_id = safe_record(ctx, company)
    yield ctx
    ctx.env.user.company_id = current_company