cubicweb #3724293 tree view assumes entity is the parent of the tree_relation (and crash if it is not) [open]

For example:

class File(EntityType):
   path = String()
   filed_under = SubjectRelation(Folder, cardinality='1*')
class FileITree(ITreeAdapter):
    __select__ = is_instance(File)
    tree_relation = 'filed_under'
    parent_role = 'object'
    child_role = 'subject'

then, calling view('tree') on a File entity, will crash, because children method of ITreeAdapter will call entity.related(self.tree_relation, self.parent_role). Obviously, here entity is a child, so calling children does not make much sense.

One solution would be to only select the tree view on the parent entity type.

done in<not specified>
load left0.200
closed by<not specified>
patch[web] Only select "tree" views on a parent entity in the tree relation WIP [rejected]