fix: add .png extension to image URLs — WC rejects extensionless URLs
WooCommerce requires a file extension in image src URLs to determine file type. Added filename.png to all Odoo image URLs. Also fixed variable name ordering bugs where img_name was used before defined. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -175,8 +175,8 @@ class WooVariantPushWizard(models.TransientModel):
|
||||
if variant.id and (variant.image_variant_1920 or variant.image_1920):
|
||||
odoo_base = inst.env['ir.config_parameter'].sudo().get_param('web.base.url', '')
|
||||
if odoo_base:
|
||||
img_url = f"{odoo_base}/web/image/product.product/{variant.id}/image_1920"
|
||||
img_name = (line.sku or variant.default_code or 'variant') + '.jpg'
|
||||
img_name = (line.sku or variant.default_code or 'variant') + '.png'
|
||||
img_url = f"{odoo_base}/web/image/product.product/{variant.id}/image_1920/{img_name}"
|
||||
var_data['image'] = {
|
||||
'src': img_url,
|
||||
'name': img_name,
|
||||
@@ -250,8 +250,8 @@ class WooVariantPushWizard(models.TransientModel):
|
||||
# Build the public Odoo image URL
|
||||
odoo_base = inst.env['ir.config_parameter'].sudo().get_param('web.base.url', '')
|
||||
if odoo_base:
|
||||
img_url = f"{odoo_base}/web/image/product.product/{variant.id}/image_1920"
|
||||
img_name = (line.sku or variant.default_code or 'variant') + '.jpg'
|
||||
img_name = (line.sku or variant.default_code or 'variant') + '.png'
|
||||
img_url = f"{odoo_base}/web/image/product.product/{variant.id}/image_1920/{img_name}"
|
||||
var_data['image'] = {
|
||||
'src': img_url,
|
||||
'name': img_name,
|
||||
|
||||
Reference in New Issue
Block a user