From f24d2efe2c4a7d49ab46a89c7ffe934415c4910b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 5 Jun 2012 10:41:27 +0530 Subject: [PATCH] Parent node validation fixed for tree --- erpnext/setup/doctype/item_group/item_group.py | 2 +- erpnext/setup/doctype/territory/territory.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py index 4a5d5d09df..161ce4e1b4 100644 --- a/erpnext/setup/doctype/item_group/item_group.py +++ b/erpnext/setup/doctype/item_group/item_group.py @@ -52,7 +52,7 @@ class DocType: def validate(self): if self.doc.lft and self.doc.rgt: - res = sql("select name from `tabItem Group` where is_group = 'Yes' and docstatus!= 2 and (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(self.doc.rgt,self.doc.lft,self.doc.parent_item_group,self.doc.item_group_name)) + res = sql("select name from `tabItem Group` where is_group = 'Yes' and docstatus!= 2 and name ='%s' and name !='%s'"%(self.doc.parent_item_group,self.doc.item_group_name)) if not res: msgprint("Please enter proper parent item group.") raise Exception diff --git a/erpnext/setup/doctype/territory/territory.py b/erpnext/setup/doctype/territory/territory.py index 5f71cf6535..606efa8ef9 100644 --- a/erpnext/setup/doctype/territory/territory.py +++ b/erpnext/setup/doctype/territory/territory.py @@ -61,7 +61,7 @@ class DocType: def validate(self): if self.doc.lft and self.doc.rgt: - res = sql("select name from `tabTerritory` where is_group = 'Yes' and docstatus!= 2 and (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(self.doc.rgt,self.doc.lft,self.doc.parent_territory,self.doc.territory_name)) + res = sql("select name from `tabTerritory` where is_group = 'Yes' and docstatus!= 2 and name ='%s' and name !='%s'"%(self.doc.parent_territory,self.doc.territory_name)) if not res: msgprint("Please enter proper parent territory.") raise Exception