fix: single variant creation error

(cherry picked from commit bda75135c3)
This commit is contained in:
Mihir Kandoi
2026-05-26 12:53:47 +05:30
committed by Mergify
parent 69c6ed3cd9
commit 82b0372d5b

View File

@@ -871,8 +871,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(