old_contents: from odoo import fields, models
  
  
  class PurchaseOrder(models.Model):
      _inherit = "purchase.order"
  
      def action_config_start(self):
          """Return action to start configuration wizard"""
          configurator_obj = self.env["product.configurator.purchase"]
          ctx = dict(
              self.env.context,
              default_order_id=self.id,
              wizard_model="product.configurator.purchase",
              allow_preset_selection=True,
          )
          return configurator_obj.with_context(ctx).get_wizard_action()
  
  
  class PurchaseOrderLine(models.Model):
      _inherit = "purchase.order.line"
  
      custom_value_ids = fields.One2many(
          comodel_name="product.attribute.value.custom",
          inverse_name="product_id",
          related="product_id.value_custom_ids",
          string="Custom Values",
      )
      config_ok = fields.Boolean(
          related="product_id.config_ok", string="Configurable", readonly=True
      )
      config_session_id = fields.Many2one(
          comodel_name="product.config.session", string="Config Session"
      )
  
      def reconfigure_product(self):
          """ Creates and launches a product configurator wizard with a linked
          template and variant in order to re-configure a existing product. It is
          esetially a shortcut to pre-fill configuration data of a variant"""
          wizard_model = "product.configurator.purchase"
          extra_vals = {
              "order_id": self.order_id.id,
              "order_line_id": self.id,
              "product_id": self.product_id.id,
          }
          self = self.with_context(
              {
                  "default_order_id": self.order_id.id,
                  "default_order_line_id": self.id,
              }
          )
          return self.product_id.product_tmpl_id.create_config_wizard(
              model_name=wizard_model, extra_vals=extra_vals
          )
  
new_contents: from odoo import fields, models
  
  
  class PurchaseOrder(models.Model):
      _inherit = "purchase.order"
  
      def action_config_start(self):
          """Return action to start configuration wizard"""
          configurator_obj = self.env["product.configurator.purchase"]
          ctx = dict(
              self.env.context,
              default_order_id=self.id,
              wizard_model="product.configurator.purchase",
              allow_preset_selection=True,
          )
          return configurator_obj.with_context(ctx).get_wizard_action()
  
  
  class PurchaseOrderLine(models.Model):
      _inherit = "purchase.order.line"
  
      custom_value_ids = fields.One2many(
          comodel_name="product.attribute.value.custom",
          inverse_name="product_id",
          related="config_session_id.value_custom_ids",
          string="Custom Values",
      )
      config_ok = fields.Boolean(
          related="product_id.config_ok", string="Configurable", readonly=True
      )
      config_session_id = fields.Many2one(
          comodel_name="product.config.session", string="Config Session"
      )
  
      def reconfigure_product(self):
          """ Creates and launches a product configurator wizard with a linked
          template and variant in order to re-configure a existing product. It is
          esetially a shortcut to pre-fill configuration data of a variant"""
          wizard_model = "product.configurator.purchase"
          extra_vals = {
              "order_id": self.order_id.id,
              "order_line_id": self.id,
              "product_id": self.product_id.id,
          }
          self = self.with_context(
              {
                  "default_order_id": self.order_id.id,
                  "default_order_line_id": self.id,
              }
          )
          return self.product_id.product_tmpl_id.create_config_wizard(
              model_name=wizard_model, extra_vals=extra_vals
          )
  
subject: make custom_value_ids related to config session instead of variant