Skip to Content
Menu
This question has been flagged
1 Atsakyti
3073 Rodiniai

I spent hours doing this and don't want to do it again.

Portretas
Atmesti
Best Answer

Create a Server Action like this:


for record in records:
product_template = env['product.template'].search([('id','=',record.res_id)])
for variant in product_template.product_variant_ids:
new_attachment = record.copy()
new_attachment['res_id'] = variant.id
new_attachment['res_model'] = 'product.product'


And make sure to click CREATE CONTEXTUAL ACTION so you can select the relevant attachments and have them copied from the product.template to the product.variant:


Then you can re-select all the attachments and DELETE them (if applicable).

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
0
lapkr. 23
1170
3
geg. 25
1467
3
lapkr. 24
8218
3
rugs. 24
6046
0
gruod. 17
3859