fix: single variant creation error

This commit is contained in:
Mihir Kandoi
2026-05-26 12:53:47 +05:30
parent 2a01a37d5d
commit bda75135c3

View File

@@ -889,8 +889,13 @@ class Item(Document):
if disabled:
frappe.throw(_("Attribute {0} is disabled.").format(frappe.bold(d.attribute)))
if not numeric_values and not frappe.db.exists(
"Item Attribute Value", {"parent": d.attribute, "attribute_value": d.attribute_value}
if (
not numeric_values
and d.attribute_value
and not frappe.db.exists(
"Item Attribute Value",
{"parent": d.attribute, "attribute_value": d.attribute_value},
)
):
frappe.throw(
_("Attribute Value {0} is not valid for the selected attribute {1}.").format(