fix: Added description if item variants does not have description in map(v12) (#17796)
* fix: variant item description based on attribute
* style: removed unwanted changes
diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py
index 631f775..bfb8432 100644
--- a/erpnext/controllers/item_variant.py
+++ b/erpnext/controllers/item_variant.py
@@ -279,14 +279,14 @@
variant.set(field.fieldname, item.get(field.fieldname))
variant.variant_of = item.name
- if 'description' in allow_fields:
- variant.has_variants = 0
+
+ if 'description' not in allow_fields:
if not variant.description:
variant.description = ""
if item.variant_based_on=='Item Attribute':
if variant.attributes:
- attributes_description = ""
+ attributes_description = item.description + " "
for d in variant.attributes:
attributes_description += "<div>" + d.attribute + ": " + cstr(d.attribute_value) + "</div>"