mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-29 09:01:14 +02:00
fix: variant item description based on attribute (#17627)
* fix: variant item description based on attribute * fix: requested changes * style: removed print
This commit is contained in:
@@ -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 += "<div>" + d.attribute + ": " + cstr(d.attribute_value) + "</div>"
|
||||
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 = "<div><b>" + item.name + "</b></div>"
|
||||
for d in variant.attributes:
|
||||
variant.description += "<div><b>" + d.attribute + "</b>: " + cstr(d.attribute_value) + "</div>"
|
||||
|
||||
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"""
|
||||
|
||||
Reference in New Issue
Block a user