Parent node validation fixed for tree

This commit is contained in:
Nabin Hait 2012-06-05 10:41:27 +05:30
parent c84c86e458
commit f24d2efe2c
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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