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.