code: def migrate_attachment_report_options(portal):
      
      attachments = api.search({"portal_type": "Attachment"})
      total = len(attachments)
      logger.info("Migrating 'Attach to Report' -> 'Ingore in Report' "
                  "for %d attachments" % total)
      for num, attachment in enumerate(attachments):
          obj = api.get_object(attachment)
  
          if obj.getReportOption() in ["a", ""]:
              obj.setReportOption("i")
              obj.reindexObject()
              logger.info("Migrated Attachment %s" % obj.getTextTitle())
docs: Migrate Attachments with the report option "a" (attach in report)
         to the option to "i" (ignore in report)