parameters: (self)
docstring: Suggest accessories based on 'Accessory Products' of products in cart
docstring_summary: Suggest accessories based on 'Accessory Products' of products in cart
docstring_tokens: Suggest accessories based on Accessory Products of products in cart
function: def _cart_accessories(self):
          """ Suggest accessories based on 'Accessory Products' of products in cart """
          for order in self:
              products = order.website_order_line.mapped('product_id')
              accessory_products = self.env['product.product']
              for line in order.website_order_line.filtered(lambda l: l.product_id):
                  combination = line.product_id.product_template_attribute_value_ids + line.product_no_variant_attribute_value_ids
                  accessory_products |= line.product_id.product_tmpl_id._get_website_accessory_product().filtered(lambda product:
                      product not in products and
                      product._is_variant_possible(parent_combination=combination) and
                      (product.company_id == line.company_id or not product.company_id)
                  )
  
              return random.sample(accessory_products, len(accessory_products))
function_tokens: def _cart_accessories ( self ) : for order in self : products = order . website_order_line . mapped ( 'product_id' ) accessory_products = self . env [ 'product.product' ] for line in order . website_order_line . filtered ( lambda l : l . product_id ) : combination = line . product_id . product_template_attribute_value_ids + line . product_no_variant_attribute_value_ids accessory_products |= line . product_id . product_tmpl_id . _get_website_accessory_product ( ) . filtered ( lambda product : product not in products and product . _is_variant_possible ( parent_combination = combination ) and ( product . company_id == line . company_id or not product . company_id ) ) return random . sample ( accessory_products , len ( accessory_products ) )