I want to automatically assign a SKU (internal reference code) to products depending on if they have the attribute "Organic". If Variants are created I want them only to be given an SKU if they have the attribute "Organic.
My current automated Action:
Model: Product
Active: True
Trigger: On Creation & Update
Trigger Fields:
Before Update Domain: Match all records
Apply on: Product Attributes > Values > Value = "Organic
Internal Reference is not set
Product Category > Name = "Food"
Action To Do : Update the Record
Data to write:
Field: Internal Reference (product.product)
Evaluation Type : Python expression
Value: env['ir.sequence'].next_by_code('organic_sku')
When I create a product and give it many variants, all of the variants are given SKUs even though only one of the variants had organic.
(example the variants: (product1, organic, blue), (product2, conventional, red) and (product3, conventional, green) will all be given an SKU even though only product1 is organic).
How can it give each variant an SKU only if that variant is Organic?
Thanks for the Help
James Camfield
Odoo 14.0+e (Enterprise Edition)