From 89cec1846773f6aa055023077401e3196d2373a0 Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Fri, 19 May 2017 12:35:36 +0530 Subject: [PATCH] set variant name based on template name (frappe/erpnext#6367) (#8920) --- erpnext/controllers/item_variant.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py index 53421b71bc..334930314b 100644 --- a/erpnext/controllers/item_variant.py +++ b/erpnext/controllers/item_variant.py @@ -165,7 +165,7 @@ def create_variant(item, args): variant.set("attributes", variant_attributes) copy_attributes_to_variant(template, variant) - make_variant_item_code(template.item_code, variant) + make_variant_item_code(template.item_code, template.item_name, variant) return variant @@ -194,7 +194,7 @@ def copy_attributes_to_variant(item, variant): for d in variant.attributes: variant.description += "

" + d.attribute + ": " + cstr(d.attribute_value) + "

" -def make_variant_item_code(template_item_code, variant): +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""" if variant.item_code: return @@ -220,6 +220,4 @@ def make_variant_item_code(template_item_code, variant): if abbreviations: variant.item_code = "{0}-{1}".format(template_item_code, "-".join(abbreviations)) - - if variant.item_code: - variant.item_name = variant.item_code + variant.item_name = "{0}-{1}".format(template_item_name, "-".join(abbreviations))