From 4258753ae8034a583940a3f09e4322f01d9be4eb Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Thu, 21 May 2015 12:22:33 +0530 Subject: [PATCH] validation added to item varients --- erpnext/stock/doctype/item/item.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index de605021bd..e5f70c4317 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -161,6 +161,10 @@ class Item(WebsiteGenerator): frappe.throw(_("{0} {1} is entered more than once in Item Variants table") .format(d.item_attribute, d.item_attribute_value), DuplicateVariant) variants.append(key) + + if not d.item_attribute_value in [t.attribute_value for t in frappe.db.get_all("Item Attribute Value", + fields=["attribute_value"], filters={"parent": d.item_attribute })]: + frappe.throw(_("Attribute value {0} does not exist in Item Attribute Master.").format(d.item_attribute_value)) else: frappe.throw(_("Please enter atleast one attribute row in Item Variants table"))