erp5_discussion: discover metadata synchronously of discussion thread's attachment

When some types of files are attached to a forum thread, they may be
subjected to a portal type migration. This is the case of CSV files, for exemple. What
happens in that case, is that the document D1 is created with portal_type PT1, then
discoverMetadata is called, which triggers a portal type migration. Then D1 is deleted, and
recreated as D2 with portal type D2. The problem is that the migration happens after D1 was attached to
the Discussion Post (in a different transaction), so the relation between both is broken.
3 jobs for for_testrunner_3 in 0 seconds
Status Job ID Name Coverage
  External
failed ERP5.UnitTest-Master

01:49:31

passed SlapOS.Eggs.UnitTest-Master.Python2

00:11:15

passed SlapOS.Eggs.UnitTest-Master.Python3

00:52:48