From 8e9413829dfa4cb01e99448b3d9cf0551dd00f39 Mon Sep 17 00:00:00 2001 From: Anurag Mishra <32095923+Anurag810@users.noreply.github.com> Date: Thu, 16 May 2019 13:57:35 +0530 Subject: [PATCH] fix: variant item description based on attribute (#17627) * fix: variant item description based on attribute * fix: requested changes * style: removed print --- erpnext/controllers/item_variant.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py index 646f23879a9..31ae83a0ce2 100644 --- a/erpnext/controllers/item_variant.py +++ b/erpnext/controllers/item_variant.py @@ -287,19 +287,15 @@ def copy_attributes_to_variant(item, variant): variant.set(field.fieldname, item.get(field.fieldname)) variant.variant_of = item.name - if 'description' in allow_fields: - variant.has_variants = 0 - if not variant.description: - variant.description = "" - if item.variant_based_on=='Item Attribute': - if variant.attributes: - attributes_description = "" - for d in variant.attributes: - attributes_description += "
" + d.attribute + ": " + cstr(d.attribute_value) + "
" + if not variant.description: + variant.description = "" - if attributes_description not in variant.description: - variant.description += attributes_description + if 'description' not in allow_fields: + if item.variant_based_on == 'Item Attribute' and not variant.description: + variant.description = "
" + item.name + "
" + for d in variant.attributes: + variant.description += "
" + d.attribute + ": " + cstr(d.attribute_value) + "
" 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"""