code: def renameAfterCreation(obj):
      
      # Check if the _bika_id was already set
      bika_id = getattr(obj, "_bika_id", None)
      if bika_id is not None:
          return bika_id
      # Can't rename without a subtransaction commit when using portal_factory
      transaction.savepoint(optimistic=True)
      # The id returned should be normalized already
      new_id = None
      # Checking if an adapter exists for this content type. If yes, we will
      # get new_id from adapter.
      for name, adapter in getAdapters((obj, ), IIdServer):
          if new_id:
              logger.warn(('More than one ID Generator Adapter found for'
                           'content type -> %s') % obj.portal_type)
          new_id = adapter.generate_id(obj.portal_type)
      if not new_id:
          new_id = generateUniqueId(obj)
  
      # TODO: This is a naive check just in current folder
      # -> this should check globally for duplicate objects with same prefix
      # N.B. a check like `search_by_prefix` each time would probably slow things
      # down too much!
      # -> A solution could be to store all IDs with a certain prefix in a storage
      parent = api.get_parent(obj)
      if new_id in parent.objectIds():
          # XXX We could do the check in a `while` loop and generate a new one.
          raise KeyError("The ID {} is already taken in the path {}".format(
              new_id, api.get_path(parent)))
      # rename the object to the new id
      parent.manage_renameObject(obj.id, new_id)
  
      return new_id
docs: Rename the content after it was created/added