code: def set_partner_id_from_partner_address_id(
          cr, pool, model_name, partner_field, address_field, table=None):
      
      model = pool.get(model_name)
      table = table or model._table
      openupgrade.logged_query(
          cr,
          """
          UPDATE %(table)s
          SET %(partner_field)s=address.openupgrade_7_migrated_to_partner_id
          FROM res_partner_address address
          WHERE %(table)s.%(address_field)s=address.id
          """ % {'table': table,
                 'partner_field': partner_field,
                 'address_field': address_field})
docs: Set the new partner_id on any table with migrated contact ids
  
      :param model_name: the model name of the target table
      :param partner_field: the column in the target model's table \
                            that will store the new partner when found
      :param address_field: the legacy field in the model's table \
                      that contains the old address in the model's table
      :param table: override the target model's table name in case it was renamed
      :returns: nothing