From cfecf3c5b104d3de70710c49c42aae5718d35beb Mon Sep 17 00:00:00 2001 From: Anurag Mishra <32095923+Anurag810@users.noreply.github.com> Date: Wed, 29 May 2019 17:16:48 +0530 Subject: [PATCH] fix: Added description if item variants does not have description in map (#17795) * fix: variant item description based on attribute * fix: requested changes * fix: refactor --- erpnext/controllers/item_variant.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py index 31ae83a0ce2..4230d17ff0e 100644 --- a/erpnext/controllers/item_variant.py +++ b/erpnext/controllers/item_variant.py @@ -288,14 +288,18 @@ def copy_attributes_to_variant(item, variant): variant.variant_of = item.name - if not variant.description: - variant.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) + "
" + if not variant.description: + variant.description = "" + + if item.variant_based_on=='Item Attribute': + if variant.attributes: + attributes_description = item.description + " " + for d in variant.attributes: + attributes_description += "
" + d.attribute + ": " + cstr(d.attribute_value) + "
" + + 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"""