code: def records2ids(iterable):
      
      def record2id(elt):
          """If `elt` is a record, return its ID."""
          if isinstance(elt, Model):
              return elt.id
          return elt
      return [record2id(elt) for elt in iterable]
docs: Replace records contained in `iterable` with their corresponding IDs:
  
          >>> groups = list(odoo.env.user.groups_id)
          >>> records2ids(groups)
          [1, 2, 3, 14, 17, 18, 19, 7, 8, 9, 5, 20, 21, 22, 23]