-
product_tmpl_id
-
product_tmpl_id.website_url
-
product_template_attribute_value_ids
-
product_template_attribute_value_ids.product_attribute_value_id
|
slug = self.env["ir.http"]._slug
for product in self:
url = urlparse(product.product_tmpl_id.website_url)
if pavs := product.product_template_attribute_value_ids.product_attribute_value_id:
# There's no need to group the PAVs by attribute since a product variant can have
# only one PAV per attribute.
query_params = {slug(pav.attribute_id): slug(pav) for pav in pavs}
url = url._replace(query=urlencode(query_params))
product.website_url = url.geturl()
|
|