Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
2 Respostas
334 Visualizações

I have red, blue, purple and yellow shirts in 7 different sizes. This creates 21 different variants. 

It seems the only way I can assign a blue shirt picture to the blue variant is by going into each of the 7 size variants and uploading the blue shirt image. And then repeating another 14 times for the other two colours (the product template image applies by default so I don't need to do every variant). 

Is that how it is supposed to be done? Is there a better way?

Avatar
Cancelar

hello,

for that you need a customization.

Melhor resposta

Hi,

Method 1: Import File


    Export Product Variants


        Go to Inventory → Products → Products


        Apply filter: Product Type = Product Variants


        Click Export and include:


            External ID (required)


            Image field (or Image URL for web-hosted images)


    Prepare Your Import File


        Use the same image URL/path for all variants sharing an image


        Example: All "Blue Shirt" variants would reference


    Reimport the Updated CSV


        Go to Import Records in the Product list view


        Map the External ID and Image fields


        Validate the import


For a visual guide, refer to:

Odoo Product Image Import Tutorial


Method 2: Automated Assignment via Attribute Values (Technical)


For advanced users, create a custom rule to auto-assign images based on attributes:


    Enable Developer Mode (?debug=1)


    Navigate to Settings → Technical → Actions → Server Actions


    Create a new action with Python code like:


       for variant in records:

             if variant.attribute_value_id.name == "Blue":

                    variant.image_variant_1920 = base64.b64encode(

                     requests.get("https://your-image-url.jpg").content

                 )


Hope it helps

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
3
nov. 24
6887
3
set. 24
5000
0
dez. 17
3287
1
abr. 25
4232
1
mar. 15
3838