def autoset_owner_id_for_advanced_action(action):
    """
    The owner_id should be set if any indices are not 'extension'.
    If it was explicitly_set, never autoset it.
    """

    explicitly_set = ('owner_id' in action.case_properties)

    if explicitly_set:
        return False

    if not len(action.case_indices):
        return True

    for index in action.case_indices:
        if index.relationship == 'child':
            # if there is a child relationship, autoset
            return True
    # if there are only extension indices, don't autoset
    return False