[fix] Patch template item to be shown in website, show variant's description and price on change of attribute
This commit is contained in:
@@ -60,7 +60,7 @@ def validate_item_variant_attributes(item, args):
|
||||
if not (is_in_range and is_incremental):
|
||||
frappe.throw(_("Value for Attribute {0} must be within the range of {1} to {2} in the increments of {3}")\
|
||||
.format(attribute, from_range, to_range, increment), InvalidItemAttributeValueError)
|
||||
|
||||
|
||||
elif value not in attribute_values.get(attribute, []):
|
||||
frappe.throw(_("Value {0} for Attribute {1} does not exist in the list of valid Item Attribute Values").format(
|
||||
value, attribute))
|
||||
@@ -125,12 +125,11 @@ def copy_attributes_to_variant(item, variant):
|
||||
from frappe.model import no_value_fields
|
||||
for field in item.meta.fields:
|
||||
if field.fieldtype not in no_value_fields and (not field.no_copy)\
|
||||
and field.fieldname not in ("item_code", "item_name"):
|
||||
and field.fieldname not in ("item_code", "item_name", "show_in_website"):
|
||||
if variant.get(field.fieldname) != item.get(field.fieldname):
|
||||
variant.set(field.fieldname, item.get(field.fieldname))
|
||||
variant.variant_of = item.name
|
||||
variant.has_variants = 0
|
||||
variant.show_in_website = 0
|
||||
if variant.attributes:
|
||||
variant.description += "\n"
|
||||
for d in variant.attributes:
|
||||
|
||||
Reference in New Issue
Block a user