Adding a relation outside a subsite returns an error

Using a RelationChoice field, I cannot create a relation outside a subsite. I am using the latest Plone. The site has subsites (each subsite implements INavigationRoot). On the root level, images and files are stored.

When I try to add a relation (outside of the subsite), I get a vague 'constraint not satisfied' error. Adding relations within the subsite is working properly:

Example structure:

- Plone site
  - Subsite 1
  - Subsite 2
  - Root images
  - Root folders

From a subsite I want to create a relation to to one of the root folders. Currently I have this field in my behavior:

    image_reference = RelationChoice(

My hunch is, that is not allowed to create a relation outside of the subsite. However I'll handle the resolving of the root files/images in the view logic. I tried searching in the docs/ for this error message but I could not find anything related. It seems the relation field has a constraint set, but where and how to disable this specific one? How can I fix this?

A subsite is supposed to be self-contained - for good or bad. It is as it is. Catalog queries inside a subsite will only return items from the subsite. If needed provide your own vocabulary which could bypass the catalog query. I am not sure at which Plone injects the INavigation constraint however in doubt you might be able to use
portal_catalog.unrestrictedSearchResults() by-passing all constraints including security related constrains...

Ok, sounds logical. :slight_smile: The error is not very clear, but then again I'm customizing Plone with subsites. I've added an override for AddonEditForm.extractData() to allow this specific error and add the object outside the subsite (see this gist for those encountering the same edge case).

Preferably I would remove the constraint but this seems too complex. I've searched in CMFPlone, plone.dexterity and z3c.form but could not find out where this specific constraint is set. The results returned by vocabulary='' already include the objects outside the subsite.