erp5_core: Don't crash jump if there's no portal_type defined and no related document

5 jobs for master in 0 seconds
Status Job ID Name Coverage
  External
passed ERP5.CodingStyleTest-Master

00:54:41

failed ERP5.UnitTest-Master

01:57:05

passed SlapOS.Eggs.UnitTest-Master.Python2

00:15:09

passed SlapOS.Eggs.UnitTest-Master.Python3

00:16:25

passed Wendelin.UnitTest-Master

00:39:20