mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 00:14:50 +00: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.set(field.fieldname, item.get(field.fieldname))
|
||||||
|
|
||||||
variant.variant_of = item.name
|
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 not variant.description:
|
||||||
if variant.attributes:
|
variant.description = ""
|
||||||
attributes_description = ""
|
|
||||||
for d in variant.attributes:
|
|
||||||
attributes_description += "<div>" + d.attribute + ": " + cstr(d.attribute_value) + "</div>"
|
|
||||||
|
|
||||||
if attributes_description not in variant.description:
|
if 'description' not in allow_fields:
|
||||||
variant.description += attributes_description
|
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):
|
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"""
|
"""Uses template's item code and abbreviations to make variant's item code"""
|
||||||
|
|||||||
Reference in New Issue
Block a user