Skip to content

Commit cfecf3c

Browse files
authored
fix: Added description if item variants does not have description in map (frappe#17795)
* fix: variant item description based on attribute * fix: requested changes * fix: refactor
1 parent 831100b commit cfecf3c

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

erpnext/controllers/item_variant.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -288,14 +288,18 @@ def copy_attributes_to_variant(item, variant):
288288

289289
variant.variant_of = item.name
290290

291-
if not variant.description:
292-
variant.description = ""
293-
294291
if 'description' not in allow_fields:
295-
if item.variant_based_on == 'Item Attribute' and not variant.description:
296-
variant.description = "<div><b>" + item.name + "</b></div>"
297-
for d in variant.attributes:
298-
variant.description += "<div><b>" + d.attribute + "</b>: " + cstr(d.attribute_value) + "</div>"
292+
if not variant.description:
293+
variant.description = ""
294+
295+
if item.variant_based_on=='Item Attribute':
296+
if variant.attributes:
297+
attributes_description = item.description + " "
298+
for d in variant.attributes:
299+
attributes_description += "<div>" + d.attribute + ": " + cstr(d.attribute_value) + "</div>"
300+
301+
if attributes_description not in variant.description:
302+
variant.description += attributes_description
299303

300304
def make_variant_item_code(template_item_code, template_item_name, variant):
301305
"""Uses template's item code and abbreviations to make variant's item code"""

0 commit comments

Comments
 (0)