def user_can_edit_invoice_type(user, content_type):
    """ true if user has any permission related to this content type """
    if user.is_active and user.is_superuser:
        return True
    permission_codenames = content_type.permission_set.values_list('codename',
        flat=True)
    for codename in permission_codenames:
        permission_name = '%s.%s' % (content_type.app_label, codename)
        if user.has_perm(permission_name):
            return True
    return False
