fix on DocumentObjects chain

add also a unit test
Merge remote-tracking branch 'origin/4.0-bedita-objects' into 4.0-bedita-objects