Update variant description based on attribute if not already there (#11302)
diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py
index 8ca4f70..f40d519 100644
--- a/erpnext/controllers/item_variant.py
+++ b/erpnext/controllers/item_variant.py
@@ -201,14 +201,16 @@
variant.variant_of = item.name
variant.has_variants = 0
if not variant.description:
- variant.description = ''
+ variant.description = ""
if item.variant_based_on=='Item Attribute':
if variant.attributes:
- if not variant.description:
- variant.description += "\n"
- for d in variant.attributes:
- variant.description += "<div>" + d.attribute + ": " + cstr(d.attribute_value) + "</div>"
+ attributes_description = ""
+ for d in variant.attributes:
+ attributes_description += "<div>" + d.attribute + ": " + cstr(d.attribute_value) + "</div>"
+
+ if attributes_description not in variant.description:
+ variant.description += attributes_description
def make_variant_item_code(template_item_code, template_item_name, variant):
"""Uses template's item code and abbreviations to make variant's item code"""