From 5b7603798811ed9b946b7a0c8beb163b1d2a8e12 Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Wed, 1 Apr 2026 22:06:32 -0400 Subject: [PATCH] fix: don't re-upload images for already-synced variants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pre-fill image field only for NEW variants. Already-synced variants get an empty image field — existing WC image is kept unless the user actively uploads a new one in the wizard. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../fusion_woocommerce/wizard/woo_variant_push.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fusion-woo-odoo/fusion_woocommerce/wizard/woo_variant_push.py b/fusion-woo-odoo/fusion_woocommerce/wizard/woo_variant_push.py index 013f939d..e10ddd4d 100644 --- a/fusion-woo-odoo/fusion_woocommerce/wizard/woo_variant_push.py +++ b/fusion-woo-odoo/fusion_woocommerce/wizard/woo_variant_push.py @@ -51,6 +51,13 @@ class WooVariantPushWizard(models.TransientModel): variant.product_template_attribute_value_ids.mapped('name') ) is_first = len(lines) == 0 + # For already-synced variants, don't pre-fill image + # (to avoid re-uploading the same image on every sync) + # User can upload a new image if they want to change it + pre_image = False + if not already_mapped: + pre_image = variant.image_variant_1920 or variant.image_1920 or False + lines.append((0, 0, { 'product_id': variant.id, 'variant_name': variant.display_name, @@ -59,7 +66,7 @@ class WooVariantPushWizard(models.TransientModel): 'regular_price': already_mapped.woo_regular_price if already_mapped else variant.list_price, 'sale_price': already_mapped.woo_sale_price if already_mapped else 0.0, 'cost_price': variant.standard_price, - 'image': variant.image_variant_1920 or variant.image_1920 or False, + 'image': pre_image, 'include': True, 'is_default': is_first, 'already_synced': bool(already_mapped),