Skip to Content
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
3 Ответы
668 Представления

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?

Аватар
Отменить

hello,

for that you need a customization.

Лучший ответ

Hello Andrew,

We had the same issue for a client, we created a tool.

You can search the odoo store for :  Variant Photo Manager by Amofordesign
We did it for Odoo 17 , If you need  a different version let me know. 

Аватар
Отменить
Лучший ответ

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
3
нояб. 24
7180
3
сент. 24
5200
0
дек. 17
3381
1
апр. 25
4407
1
мар. 15
3936