From fe9cd1d8755ebe263990ec8a6e24cc5ee128bfba Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 1 Jul 2015 14:41:30 +0530 Subject: [PATCH] More Fixes in Manage Varients --- erpnext/stock/doctype/manage_variants/manage_variants.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/manage_variants/manage_variants.py b/erpnext/stock/doctype/manage_variants/manage_variants.py index 0131deb0de..b6784d3a2e 100644 --- a/erpnext/stock/doctype/manage_variants/manage_variants.py +++ b/erpnext/stock/doctype/manage_variants/manage_variants.py @@ -69,10 +69,10 @@ class ManageVariants(Document): def validate_attribute_values(self): attributes = {} + for t in frappe.db.get_all("Item Attribute Value", fields=["parent", "attribute_value"]): + attributes.setdefault(t.parent, []).append(t.attribute_value) + for d in self.attributes: - attributes.setdefault(d.attribute, - [t.attribute_value for t in - frappe.db.get_all("Item Attribute Value", fields=["attribute_value"], filters={"parent": d.attribute })]) if d.attribute_value not in attributes.get(d.attribute): frappe.throw(_("Attribute value {0} does not exist in Item Attribute Master.").format(d.attribute_value))